Syncthing is a free and open source peer to peer (P2P) file synchronization app. It allows two devices to be synchronized over the LAN or remotely over the internet. It allows one to make changes on one device such as file creation, modification and deletion which is replicated automatically on other devices. The devices could be PCs, server or mobile phones. This guide, demonstrates how to install and Use Syncthing file synchronization on Rocky Linux 8.
Syncthing has the following features;
- Safety from data loss
- Easy to use
- Helps provide security against attackers
- It is automatic and user interaction required only when neccesary
- Universally available
Install Syncthing on Rocky Linux 8
Since there is no officially supported repository for rpm installation packages in the Rocky Linux 8 repositories, we will choose to download and install Syncthing on Rocky Linux 8 from the official release page.
Check for the latest version of Synthing from the release page. Download the latest version of Synthing on Rocky Linux 8 using:
curl -s https://api.github.com/repos/syncthing/syncthing/releases/latest | grep browser_download_url | grep linux-amd64 | cut -d '"' -f 4 | wget -qi -
Now let’s extract the .tar file using:
tar xvf syncthing-linux-amd64*.tar.gz
This command unpacks in a file called synthing-linux-amd64* into the folder exists a file named synthing. We will copy it to /usr/local/bin directory.
sudo cp syncthing-linux-amd64-*/syncthing /usr/local/bin/
Confirm your installation by checking your installed version
$ syncthing --version syncthing v1.18.0 "Fermium Flea" (go1.16.5 linux-amd64) [email protected] 2021-06-21 20:53:50 UTC
Configure Syncthing on Rocky Linux 8
We need to start and enable Syncthing to run on boot. This is done by first creating a file at /etc/systemd/system/ for the service as below.
sudo vi /etc/systemd/system/[email protected]
In the created file, paste the following:
[Unit] Description=Syncthing - Open Source Continuous File Synchronization for %I Documentation=man:syncthing(1) After=network.target [Service] User=%i ExecStart=/usr/local/bin/syncthing -no-browser -gui-address="0.0.0.0:8384" -no-restart -logflags=0 Restart=on-failure SuccessExitStatus=3 4 RestartForceExitStatus=3 4 # Hardening ProtectSystem=full PrivateTmp=true SystemCallArchitectures=native MemoryDenyWriteExecute=true NoNewPrivileges=true [Install] WantedBy=multi-user.target
Update the list added on Systemd as blow:
sudo systemctl daemon-reload
Then start and enable syncthing. Here you can replace $USER with another account you want to start and use the service.
sudo systemctl start [email protected]$USER sudo systemctl enable [email protected]$USER
Confirm the status of the service.
$ systemctl status [email protected]$USER [email protected] - Syncthing - Open Source Continuous File Synchronization for rockylinux Loaded: loaded (/etc/systemd/system/[email protected]; enabled; vendor preset: disabled) Active: active (running) since Mon 2021-07-12 13:04:40 EDT; 50s ago Docs: man:syncthing(1) Main PID: 2664 (syncthing) Tasks: 12 (limit: 4937) Memory: 35.2M CGroup: /system.slice/system-syncthing.slice/[email protected] ├─2664 /usr/local/bin/syncthing -no-browser -gui-address=0.0.0.0:8384 -no-restart -logflags=0 └─2670 /usr/local/bin/syncthing -no-browser -gui-address=0.0.0.0:8384 -no-restart -logflags=0 Jul 12 13:04:41 rockylinux8 syncthing: [CCAH6] INFO: Relay listener (dynamic+https://relays.syncthing.net/endpoint) starting Jul 12 13:04:41 rockylinux8 syncthing: [CCAH6] INFO: QUIC listener ([::]:22000) starting Jul 12 13:04:41 rockylinux8 syncthing: [CCAH6] INFO: GUI and API listening on [::]:8384 Jul 12 13:04:41 rockylinux8 syncthing: [CCAH6] INFO: Access the GUI via the following URL: http://127.0.0.1:8384/ Jul 12 13:04:41 rockylinux8 syncthing: 2021/07/12 13:04:41 failed to sufficiently increase receive buffer size (was: 208 kiB, wanted: 2048 kiB,> Jul 12 13:04:41 rockylinux8 syncthing: [CCAH6] INFO: My name is "node2" Jul 12 13:04:41 rockylinux8 syncthing: [CCAH6] INFO: Completed initial scan of sendreceive folder "Default Folder" (default) Jul 12 13:04:52 rockylinux8 syncthing: [CCAH6] INFO: Detected 1 NAT service
Allow the port through the firewall
sudo firewall-cmd --add-port=8384/tcp --zone=public --permanent sudo firewall-cmd --reload
Open Syncthing UI on Rocky Linux 8
Syncthing admin GUI is started automatically on port 8384. The service runs on https://localhost:8384/
When you open syncthing for the first time, it does not ask for login credentials. You are required to set on login. Navigate to settings->GUI to set the username and password
After saving the changes, you will required to authenticate as below:
Once logged in, you should see an interface similar to this.
Sync data between devices using Syncthing
Syncing data with syncthing between devices requires one to have syncthing installed on all the devices to sync data with.
Syncthing Device ID
Incase you want to sync devices for the first time. You will require Device IDs. The ID is unique and generated as part of the key generation security measure the first time you start syncthing. Devices only communicate when they are configured with each others ID which is obtained from the Actions-> Show ID tab
Add Device ID in Syncthing
To add a device for communication, click Add Remote Device. This action is done on both devices by exchanging the keys of either sides. The folder to share is also selected on the sharing tab. You the set the device name at this point or later. Then save the changes.
The added device appears on the bottom right showing Disconnected status as below
The same is done on the other device and then save and restart syncthing by navigating to “Actions” > “Restart” tab
When both devices are restarted,the status Disconnected changes to Up to Date.
Sync data using Syncthing.
With the devices linked you can view the shared file by clicking on the “Default Folder”
When you click on the Default folder, you can see details of the shared folder such as the folder ID, Path, the device sharing and time of last scan. With this synchronization whatever you put in the
~/Sync folder on one system will be shown on the other system and can edit the file as well.
Create a New Shared Folder in Syncthing
You can possibly create multiple shared folders between the paired devices aside from the default /sync folder
To create folders, click “Add Folder” then enter the name of the folder, the Id and path of the folder to share with the other on the General tab
Then proceed to the sharing tab and select the device to share with;
Proceed to the advanced tab and set the folder type, either as Send-only or Receive-only or both Send & Receive and save
On the other device, you will be required to add the folder as below.
You are required to add and save it. Once saved, it appears on both systems as below.
In cases where you have troubles syncing files between devices with syncthing, you might want to re-scan and re-sync devices database as below
In the above guide, we have walked through the installation and use of Syncthing file synchronization on Rocky Linux 8. We have also configured syncthing on Rocky linux 8. I hope this article was helpful
Find related articles on our website.