Sync files across multiple devices with Syncthing

Learn how to sync files between devices with Syncthing in the first article in our series on 20 ways to be more productive with open source in 2020.
138 readers like this.
Files in a folder

Last year, I brought you 19 days of new (to you) productivity tools for 2019. This year, I'm taking a different approach: building an environment that will allow you to be more productive in the new year, using tools you may or may not already be using.

Syncing files with Synthing

Setting up a new machine is a pain. We all have our "standard setups" that we copy from machine to machine. And over the years, I've used a lot of ways to keep them in sync between machines. In the old days (and this will tell you how old I am), it was with floppy disks, then Zip disks, USB sticks, SCP, Rsync, Dropbox, ownCloud—you name it. And they never seemed to work right for me.

Then I stumbled upon Syncthing.

syncthing console

Syncthing is a lightweight, peer-to-peer file-synchronization system. You don't need to pay for a service, you don't need a third-party server, and it's fast. Much faster, in my experience, than many of the "big names" in file synchronization.

Syncthing is available for Linux, MacOS, Windows, and several flavors of BSD. There is also an Android app (but nothing official for iOS yet). There are even handy graphical frontends for all of the above (although I'm not going to cover those here). On Linux, there are packages available for most distributions, so installation is very straightforward.

Installing Syncthing on Ubuntu

When you start Syncthing the first time, it launches a web browser to configure the daemon. There's not much to do on the first machine, but it is a good chance to poke around the user interface (UI) a little bit. The most important thing to see is System ID under the Actions menu in the top-right.

Machine ID

Once the first machine is set up, repeat the installation on the second machine. In the UI, there will be a button on the lower-right labeled Add Remote Device. Click the button, and you will be presented with a box to enter a Device ID and a Name. Copy and paste the Device ID from the first machine and click Save.

You should see a pop-up on the first node asking to add the second. Once you accept it, the new machine will show up on the lower-right of the first one. Share the default directory with the second machine. Click on Default Folder and then click the Edit button. There are four links at the top of the pop-up. Click on Sharing and then select the second machine. Click Save and look at the second machine. You should get a prompt to accept the shared directory. Once you accept that, it will start synchronizing files between the two machines.

Sharing a directory in Syncthing

Test it out by copying a file to the default directory (/your/home/Share) on one of the machines. It should show up on the other one very quickly.

You can add as many directories as you want or need to the sharing, which is pretty handy. As you can see in the first image, I have one for myconfigs—that's where I keep my configuration files. When I get a new machine, I just install Syncthing, and if I tune a configuration on one, I don't have to update all of them—it happens automatically.

What to read next
Tags
User profile image.
Kevin Sonney is a technology professional, media producer, and podcaster. A Linux Sysadmin and Open Source advocate, Kevin has over 25 years in the IT industry, with over 15 years in Open Source. He currently works as an SRE at elastic.

1 Comment

Hello Kevin. How do you deal with sync issues when your 2 machines are behind different firewalls that you don't have access to?

Creative Commons LicenseThis work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.