Skip to content

Latest commit

 

History

History
73 lines (58 loc) · 2.37 KB

04_Syncthing.md

File metadata and controls

73 lines (58 loc) · 2.37 KB

Syncthing

Install Package

Install stable Debian packages from apt.syncthing.net.

  1. Add the release PGP keys:

    curl -s https://syncthing.net/release-key.txt | sudo apt-key add -
  2. 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
  3. Update and install syncthing:

    sudo apt-get update
    sudo apt-get install syncthing

Configure Autostart

  1. 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
  2. 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 user syncthing from the relevant user-group.
      • e.g. Remove the syncthing user from the publisher group, disallowing write-access to public files, by the following:
        sudo deluser syncthing publisher
  3. Enable System-service with syncthing user.
sudo systemctl enable [email protected]
sudo systemctl start [email protected]

Optional Tweaks

  1. 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'

Next Steps

#TODO

Homepage