Install stable Debian packages from apt.syncthing.net.
-
Add the release PGP keys:
curl -s https://syncthing.net/release-key.txt | sudo apt-key add -
-
Add the "stable" channel to your APT sources:
echo "deb https://apt.syncthing.net/ syncthing stable" | sudo tee /etc/apt/sources.list.d/syncthing.list
-
Update and install syncthing:
sudo apt-get update sudo apt-get install syncthing
- Create syncthing user, adding to all groups it will sync files for.
sudo adduser --disabled-password --gecos "" syncthing for usergroup in $USER `cat users.txt` publisher; do sudo usermod -a -G $usergroup syncthing done
- Add group Read/Write/Sticky bit to ensure syncthing has permissions to write to sync paths.
for user in $USER `cat users.txt`; do # GROUP: +Read +Write sudo chmod g+rw -R /${HOSTNAME}/${user}/safe # Directories GROUP: +Xecute +Sticky # This copies group ownership to child items added to the folder. find /${HOSTNAME}/${user}/safe -type d -print0 | xargs -0 sudo chmod g+xs done
- Note this distinction is important: Keep the files owned by the relevant user (non-syncthing) group, so that syncthing can create brand new files under that same group ownership.
- Later, you can easily revoke
syncthing
's permission by removing usersyncthing
from the relevant user-group.- e.g. Remove the
syncthing
user from thepublisher
group, disallowing write-access to public files, by the following:sudo deluser syncthing publisher
- e.g. Remove the
- Enable System-service with syncthing user.
sudo systemctl enable [email protected]
sudo systemctl start [email protected]
- Increase ionotify limit (web gui often warns about this one). Follow instructions at docs.syncthing.net
# increase limit for next reboot echo "fs.inotify.max_user_watches=204800" | sudo tee -a /etc/sysctl.conf # increase current limit sudo sh -c 'echo 204800 > /proc/sys/fs/inotify/max_user_watches'
#TODO