Syncthing

From Indie IT Wiki
Revision as of 09:42, 20 January 2021 by imported>Plittlefield (→‎Access Control Lists ACL)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Starting Syncthing Automatically

Run at user log on using the Startup folder

Access Control Lists ACL

https://github.com/angeloxx/syncthing-acl

HOWTO: Unpause Via The Command Line

curl -X POST -H "X-API-Key: myapikey" http://localhost:8384/rest/system/resume?device=DEVICE-ID

Android App

Syncthing for Android by Felix Ableitner

HOWTO: INSTALLATION & CONFIGURATION:

OS X

In the following example the user will be called 'Mac'.

Create a folder called 'bin' in your user profile.

Download Syncthing and extract the binary file (it is the one call Syncthing with no file extension) to the 'bin' folder.

Create the file required to launch Syncthing:

touch ~/Library/LaunchAgents/se.nym.syncthing.plist

Edit the file adding the text below, remembering to change the path /Users/Mac/bin/syncthing (line 9) to match where you have copied the syncthing binary file and /Users/Mac (line 14) to your home directory:

nano ~/Library/LaunchAgents/se.nym.syncthing.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
        <dict>
                <key>Label</key>
                <string>se.nym.syncthing</string>
                <key>ProgramArguments</key>
                <array>
                        <string>/Users/Mac/bin/syncthing</string>
                </array>
                <key>EnvironmentVariables</key>
                <dict>
                        <key>HOME</key>
                        <string>/Users/Mac</string>
                        <key>STNORESTART</key>
                        <string>1</string>
                </dict>
                <key>KeepAlive</key>
                <true/>
        </dict>
</plist>

Run the following to launch Syncthing:

launchctl load ~/Library/LaunchAgents/se.nym.syncthing.plist

Your default web browser should launch and open the Syncthing interface (http://127.0.0.1:8384/).

Once opened go to Actions >> Settings >> and untick the 'Launch Browser' option. This will prevent the web browser from being launched everytime the user logs in.

Thanks to Jakob Borg at the Syncthing Forum.

Ubuntu

Add the release PGP keys, then "release" channel to your APT sources:

curl -s https://syncthing.net/release-key.txt | sudo apt-key add -
echo deb http://apt.syncthing.net/ syncthing release | sudo tee /etc/apt/sources.list.d/syncthing-release.list

Update the packages list and install Syncthing:

sudo apt-get update && sudo apt-get install syncthing

Start Syncthing...

syncthing &

...and wait for your web browser to load the GUI interface.

Once the GUI has loaded go back to the terminal and CTRL+C to detach the process.

Thanks to Syncthing

Ubuntu Server

16.04 SystemD

https://www.linuxbabe.com/apps/syncthing-0-14-5-install-ubuntu-16-04

sudo apt-get install curl apt-transport-https
curl -s https://syncthing.net/release-key.txt | sudo apt-key add -
echo "deb http://apt.syncthing.net/ syncthing release" | sudo tee /etc/apt/sources.list.d/syncthing.list
sudo apt-get update
sudo apt-get install syncthing
ll /lib/systemd/system/syncthing*
sudo systemctl enable syncthing@joebloggs.service
sudo systemctl start syncthing@joebloggs.service
systemctl status syncthing@joebloggs.service
sudo systemctl stop syncthing@joebloggs.service
systemctl status syncthing@joebloggs.service
nano .config/syncthing/config.xml
       <address>0.0.0.0:8384</address>
sudo systemctl start syncthing@joebloggs.service
systemctl status syncthing@joebloggs.service

14.04 Upstart

sudo apt-get install curl apt-transport-https
curl -s https://syncthing.net/release-key.txt | sudo apt-key add -
echo "deb http://apt.syncthing.net/ syncthing release" | sudo tee /etc/apt/sources.list.d/syncthing.list
sudo apt-get update
sudo apt-get install syncthing
sudo nano /etc/init/syncthing

# syncthing - Open Source Continuous File Synchronization
description "Syncthing - Open Source Continuous File Synchronization"
exec sudo -u user /usr/bin/syncthing --no-browser
start on (local-filesystems and net-device-up IFACE!=lo)
stop on runlevel [!2345]
respawn

sudo initctl start syncthing

https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-syncthing-to-synchronize-directories-on-ubuntu-14-04

Windows

http://docs.syncthing.net/users/autostart.html#windows

Accessing Web GUI On Headless Install (Server)

You will need to edit Syncthing's configuration file:

sudo nano .config/syncthing/config.xml

<gui enabled="true" tls="false">
       <address>127.0.0.1:8384</address>

<gui enabled="true" tls="false">
       <address>0.0.0.0:8384</address>

Adding To Startup Applications

/usr/bin/syncthing -no-browser

Prevent Syncthing Launching Web Browser

By default if you have Syncthing set to start when you log in it will attempt to open the GUI in the system default web browser.

You can either add the "-no-browser" option to the startup setting (as shown in the previous tip) or the option is available from the GUI:

Action >> Settings >> Untick "Start Browser" option

Thanks to Syncthing.

Required Firewall Ports

Open ports on the server's firewall (in this example UFW):

For internal connection (text in bold is a comment do not add to the firewall rule):

sudo ufw allow from 192.168.0.0/24 to any port 22000 proto tcp
 (or the actual listening port if you have changed the Sync Protocol Listen Address setting)
sudo ufw allow from 192.168.0.0/24 to any port 21025 proto udp
 (for discovery broadcasts)

Complete Tutorial Sync Between 2 Headless Servers

https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-syncthing-to-synchronize-directories-on-ubuntu-14-04

Ignoring Files

Create a file called .stignore in the folder you are syncing.

Here is an example of "ignoring everything except Thunderbird Filters files"...

*
!msgFilterRules.dat

Thanks - http://docs.syncthing.net/users/ignoring.html

From Dropbox to Syncthing (Good Directory Structure)

https://klingt.net/blog/from-dropbox-to-syncthing/

Syncthing Official Links

Syncthing Home Page

Syncthing Getting Started

Syncthing Documentation | Help

Syncthing at GitHub

Links

Donate Money To Syncthing Project

https://play.google.com/store/apps/details?id=com.nutomic.syncthingandroid

https://github.com/icaruseffect/syncthing-ubuntu-indicator

http://sysads.co.uk/2015/03/how-to-install-syncthing-0-10-27-recently-released/

http://sysads.co.uk/2014/06/syncthing-open-source-replaces-dropbox-bittorrent-sync/

http://www.webupd8.org/2015/05/official-syncthing-debian-ubuntu.html

Nice video - https://youtu.be/ycVM5pdH3xg?t=880