Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save matta/364e0d5d838a0c976c5b806f2f3de186 to your computer and use it in GitHub Desktop.
Save matta/364e0d5d838a0c976c5b806f2f3de186 to your computer and use it in GitHub Desktop.
Syncthing Ubuntu/Mint Headless

Syncthing Ubuntu/Mint Headless

Syncthing: https://syncthing.net/

Syncthing is a free, open-source peer-to-peer file synchronization application available for Windows, Mac, Linux, Android, Solaris, Darwin, and BSD. It can sync files between devices on a local network, or between remote devices over the Internet. Data security and data safety are built into the design of the software.

This is written using Linux Mint 18.1 Serena x86_64 using kernel 4.4.0-139-generic.

I couldn't find good directions for doing this, so here we go.

Install Syncthing

Add Repos

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

Install

sudo apt update
sudo apt install syncthing

Install apt-transport-https If Required

If you get the following error.

E: The method driver /usr/lib/apt/methods/https could not be found.
N: Is the package apt-transport-https installed?
E: Failed to fetch https://apt.syncthing.net/dists/syncthing/InRelease    

Install apt-transport-https

sudo apt install apt-transport-https

Syncthing User

Create User

I don't like to run services from my personal account, I also wanted the user's home directory in a non-standard path. Use whatever path you want or /home.

sudo useradd -r -M -d /raidarray/syncthing/ syncthing
sudo passwd syncthing

Login and Create Config

Login, I use su - you can use whatever.

sudo su - syncthing

Run syncthing.

syncthing

This will display a bunch of status info, just wait for a minute then do CTRL-C to force quit it. The goal here is to create the .config directory and files.

Exit back to your regular user.

exit

Disable Shell

I don't want syncthing to be able to login, so I change the shell to /bin/false.

sudo usermod --shell /bin/false syncthing

Edit the Config

I use vi you can use nano or whatever editor you like.

Here we are going to edit the syncthing user config file, you will need to change the pathing of course.

sudo vi /raidarray/syncthing/.config/syncthing/config.xml

Look for:

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

Change to:

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

Save and quit.

Setup the Service

sudo mv /lib/systemd/system/syncthing@.service /lib/systemd/system/syncthing@syncthing.service
sudo systemctl enable syncthing@syncthing.service
sudo systemctl start syncthing@syncthing.service
sudo systemctl status syncthing@syncthing.service

This should output something like:

● syncthing@syncthing.service - Syncthing - Open Source Continuous File Synchronization for syncthing
   Loaded: loaded (/lib/systemd/system/syncthing@syncthing.service; enabled; vendor preset: enabled)
   Active: active (running) since Sat 2018-11-24 16:07:43 EST; 29min ago
     Docs: man:syncthing(1)
 Main PID: 22558 (syncthing)
   CGroup: /system.slice/system-syncthing.slice/syncthing@syncthing.service
           └─22558 /usr/bin/syncthing -no-browser -no-restart -logflags=0

Open Web GUI

You should be able to browse to your syncthing WebGUI now.

http://hostname:8384

Login with syncthing and whatever password you set.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment