Syncthing on the Debian 11
If you’re on this page I am going to assume you already know what Syncthing is.
This same setup should work on any of the latest Debian-flavor distros, no need to include additional Apt sources or GPG keys, Syncthing has been included in the Debian 11 apt repository as of 2/22/23.
apt-get update && apt-get upgrade -y apt-get install apt-transport-https -y
apt-get install syncthing -y
to make sure it has been installed…
you should get something similar to:
syncthing v1.12.1-ds1 "Fermium Flea" (go1.15.9 linux-amd64) debian@debian 2021-07-23 20:27:51 UTC
This confirms that it is indeed installed.
Now we need to create a service file for systemd to start our Syncthing automatically as a system service. This configuration will allow you to access your Sycthing dashboard from any computer on your local network. YOU WILL STILL NEED TO ADD CREDENTIALS TO YOUR SYNCTHING GUI.
You can use vim or nano as your editor of choice.
Add the following lines to your syncthing@.service service file. The service file makes your Syncthing install accessible over the local network by default. By default, Syncthing uses port 8384, feel free to change it to your liking.
[Unit] Description=Syncthing - BAMF Open Source File Synchronization for %I Documentation=man:syncthing(1) After=network.target [Service] User=%i ExecStart=/usr/bin/syncthing -no-browser -gui-address="0.0.0.0:8384" -no-restart -logflags=0 Restart=on-failure SuccessExitStatus=3 4 RestartForceExitStatus=3 4 [Install] WantedBy=multi-user.target
Save and close the file when you are finished. Then, reload the systemd daemon to apply the changes.
Next, start the Syncthing service with the following command:
systemctl start syncthing@root
To access the server over your network you can simply get your local network address using
You should get a response like, the last value is your local network address:
default via 192.168.1.1 dev eth0 192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.10
We access our Syncthing dashboard by opening our browser of choice and entering http://192.168.1.10:8384 , note that, by default, Syncthing runs on port 8384. Depending on your application, if you’re server is a firewall running on it, you will need to update your settings to allow traffic on those ports or whatever ports you decide to use later.
Once logged into your dashboard you will want to update your GUI access settings. After securing your Syncthing dashboard you can then further customize your settings to your preferences.
Mounting A Windows Shared Folder/Drive For Syncthing Storage
If you have a NAS and want to mount a Windows shared drive as a storage option for Syncthing:
apt-get update && apt-get upgrade -y apt-get install cifs-utils -y
Assuming you already have a Shared Windows Folder/Drive setup, we create a folder in our standard mnt directory:
To test our connection, we mount our Windows Share drive:
mount -t cifs -o username=windowsUsername,password=windowPassword //COMPUTER_IP/SharedFolderName /mnt/Syncthing
If successful you can see your mounted folder’s content via /mnt/Syncthing
Due to the nature of Linux, this drive mount will not persist after reboot . In order to add persistence to the mount you will need to do some additional configuration to fstab.
Before we add details to our fstab, let’s create a file to store our Windows share credentials, storing in the root folder will also protect from other possible non-root users accessing the file. You can change this folder to whatever you like just keep in mind that if you have multiple users and don’t want them to see the contents of the file you will need to add additional permissions to the credentials file.
Create the local credentials file like this:
We then enter the corresponding details, don’t be a noob and actually enter windowsUsername and windowsPassword, enter your actual share details…
Save the file.
Now we edit our fstab
We add the following line:
//COMPUTER_IP/SharedFolderName /mnt/Syncthing cifs credentials=/root/windows_credentials,file_mode=0755,dir_mode=0755 0 0
Save the file.
Mount the share:
Tired of the mounted folder? Simply unmount it like this:
If you do unmount, don’t forget to remove the line from your fstab.
General note: when mounting folders, always mount to a new folder, don’t try to mount to an existing folder or you’re going to have fun figuring out what happened to the files you had in it…