Fehler, Verbesserungen oder Anmerkungen können mir gern per Email geschickt werden.

Vorraussetzungen

  • Halbwegs sicherer Umgang mit einer Linux Konsole / Terminal.

Setup

curl https://linux-packages.resilio.com/resilio-sync/key.asc | gpg --dearmor > /usr/share/keyrings/apt-resilio-key.gpg
echo "deb [signed-by=/usr/share/keyrings/apt-resilio-key.gpg] http://linux-packages.resilio.com/resilio-sync/deb resilio-sync non-free" | tee /etc/apt/sources.list.d/resilio.list

apt update
apt install resilio-sync

### Usefull variables ###
APPNAME=resilio
SYSUSER=frank
SYSUSERPORT=8888
# TODO: Parse home folder from /etc/passwd
SYSUSERHOME=/home/${SYSUSER}

### User Config ###
mkdir -p ${SYSUSERHOME}/.config/resilio-sync/storage
cat > ${SYSUSERHOME}/.config/resilio-sync/config.json <<__EOF__
{
    "device_name": "hostname",
    "storage_path" : "${SYSUSERHOME}/.config/resilio-sync/storage",
    "pid_file" : "${SYSUSERHOME}/.config/resilio-sync/sync.pid",
    //"directory_root" : "${SYSUSERHOME}/SyncResilio/",

    "webui" :
    {
        "force_https": true,
        "listen" : "0.0.0.0:${SYSUSERPORT}"
    }
}
__EOF__
# Link old default config file to new naming.
ln -s ./config.json ${SYSUSERHOME}/.config/resilio-sync/sync.conf
ln -s ./.config/resilio-sync ${SYSUSERHOME}/.sync
# Owner
chown -R ${SYSUSER}:${SYSUSER} ${SYSUSERHOME}/.config/resilio-sync/
chown -R ${SYSUSER}:${SYSUSER} ${SYSUSERHOME}/.sync

### Test ###
/usr/bin/rslsync --nodaemon --config ${SYSUSERHOME}/.config/resilio-sync/config.json --storage ${SYSUSERHOME}/.config/resilio-sync/storage

### System Config ###
cat > /etc/systemd/system/resilio-sync@.service <<__EOF__
[Unit]
Description=Resilio Sync service for %I
Documentation=https://help.resilio.com
After=network.target network-online.target

[Service]
User=%i
Type=forking
UMask=0002
Restart=on-failure
PermissionsStartOnly=true
ExecStartPre=/etc/resilio-sync/init_user_config.sh
PIDFile=/home/%i/.config/resilio-sync/sync.pid
#ExecStart=/usr/bin/rslsync --nodaemon --config /home/%i/.config/resilio-sync/config.json --storage /home/%i/.config/resilio-sync/storage
ExecStart=/usr/bin/rslsync --config /home/%i/.config/resilio-sync/config.json
ExecStartPost=/bin/sleep 1

# Hardening
#ProtectSystem=full
#PrivateTmp=true
#SystemCallArchitectures=native
#MemoryDenyWriteExecute=true
#NoNewPrivileges=true

[Install]
WantedBy=multi-user.target
__EOF__

# May cause some warnings...
#systemctl stop resilio-sync
#systemctl disable resilio-sync

systemctl daemon-reload
systemctl enable resilio-sync@${SYSUSER}
systemctl start resilio-sync@${SYSUSER}
systemctl status resilio-sync@${SYSUSER}

Abschluss

  • Aufruf der Webseite, z.B.: https://192.168.0.111:8888/gui/
  • Setzen von Nutzernamen und Passwort

Quellen