How to sync configuration files on Linux with Syncthing

In the past on AddictiveTips, we’ve talked about Symbolize, a Linux app that works with Dropbox to keep your config files in sync. However, not everyone has a Dropbox account. 

If you do not have a Dropbox cloud account but still want your Linux configs to stay in sync, the next best tool to use is Syncthing. In this guide, we’ll show you how to set up a Syncthing system that will always keep your configuration files on Linux in sync. 

Installing Syncthing GTK on Linux

Syncthing GTK is the preferred tool for syncing on the Linux desktop, as Syncthing is a web server app, and the GTK tool makes it easy to use on the desktop. However, the Syncthing GTK tool does not come pre-installed. As a result, we will need to go over how to install it before continuing.

The Syncthing GTK application is available for installation on Arch Linux, Debian 10, Ubuntu, OpenSUSE Leap, and Flatpak. To start installing the app on your computer, open up a terminal window and follow the command-line installation instructions down below.

Ubuntu

On Ubuntu, the Syncthing GTK application is installable via the Apt command.

sudo apt install syncthing-gtk

Debian 10

If you are using Debian 10, you will get Syncthing GTK working with the Apt-get command below.

sudo apt-get install syncthing-gtk

Arch Linux

Syncthing-GTK is in the Arch Linux “Community” repo. To install it, run the Pacman command.

sudo pacman -S syncthing-gtk

Fedora

Syncthing-GTK is available on Fedora 30 via the Dnf command. However, Fedora 30 is out of date (2 years to be exact). If you use Fedora and need to get Syncthing GTK working, you will need to follow the Flatpak installation instructions instead.

OpenSUSE

Syncthing GTK is available on OpenSUSE 15.1 and 15.2 via the “Oss” software repository. Ensure you have “Oss” enabled. Then, enter the command below to get Syncthing GTK working.

sudo zypper install syncthing-gtk

Flatpak

Syncthing GTK is available for installation as a Flatpak. So, if you’re a Fedora Linux user (or any other distribution that doesn’t have Syncthing GTK available) and need to install it, this is the way to go.

Installing Syncthing GTK via Flatpak requires the Flatpak runtime. To install the runtime, follow this guide on the subject. Once the runtime is set up, please enter the two commands below to get it running.

flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo flatpak install flathub me.kozec.syncthingtk

Set up Syncthing GTK 

Syncthing GTK requires configuration before use. To configure it, launch the app on your Linux desktop. Then, follow the on-screen Wizard to get the app working on your PC. Be sure to read what the Wizard tells you in detail, so you can understand how Syncthing operates on your computer.

Please note that you will need to set up Syncthing GTK on all computers that you plan to sync config files between.

Syncing config files

Syncing configuration files with Syncthing on Linux is done with the symlinking function. To set it up, follow the step-by-step instructions below.

Step 1: Pick the Linux PC that you use the most. This PC will be the one that we take configuration files from and the one that will do the config file hosting.

For example, if all of your essential configuration files are on your Desktop, set up the sync in Syncthing GTK on the desktop, and move all the config files into the “Sync” folder on this PC sync with other Linux systems.

Once you’ve figured out what PC you use as your primary, use the mv command to place your configuration files into the Syncthing “Sync” directory.

cp -r ~/.config ~/Sync

This command above will move most of your configuration files into the “Sync” folder handled by Syncthing. To sync other configuration files on your PC, you will need to change ~/.config in the command above to whichever folder you wish to keep in sync.

Step 2: In Syncthing GTK, click on the “Gear” icon next to the minimize button to access the menu button. Inside of the menu, click on “Add device” and select it. Then, use the menu to add other Linux PCs on your network to the sync.

Note: you may need to click on “Show ID” on computers you wish to add to the sync to get their ID before attempting to add it to the PC that you are hosting the sync from.

Step 3: On the PC doing the sharing, access Syncthing GTK, right-click on “Default Folder,” and select the “Edit” button. Then, look for “Share With Devices” and select it with the mouse.

Inside of the “Share With Devices” area, check the boxes next to the PCs you’ve added to your Syncthing folder, giving them access to the sync.

Step 4: After adding a device to the share, go to the device you are adding and look at the Syncthing GTK app. You will see a notification asking if you want to connect to the share. Select “Accept” to accept the connection.

Step 5: Once you’ve accepted the connection on the Linux PC attempting to connect to the Syncthing GTK share, you’ll see another notification. This notification will ask if you wish to add the “Default Folder.” Select “Yes” to add the “Sync” folder to the Linux devices that you’ve added to the sync.

Step 6: Allow the connected PCs to download the configuration files from the sync over your network. When the process is done, run the following commands on all PCs to keep your configuration files in sync using Syncthing GTK.

rm ~/.config ln -s ~/Sync/.config ~/

With the two commands run above, your configuration files will be in sync. However, keep in mind that Syncthing must be running to receive file updates.

Check Also

How to get Linux kernel 5.8 and 5.9 in Debian 10

Debian 10 sits at Linux kernel 4.19. While this kernel version isn’t exactly the oldest …

Leave a Reply

Your email address will not be published. Required fields are marked *