Use Syncthing to Create a Cloud Without a Cloud

Syncing files across devices is really easy. Just install Google Drive, or iCloud, or Dropbox, or any other cloud storage provider. But this comes at a cost, and the cost is your data. Here I am going to show you how to sync files that matter without anyone in-between.

What is Syncthing?

Syncthing is a P2P, decentralized file synchronization system. While in conventional systems, you files are uploaded to some server (Google, Apple, etc) and then downloaded on all clients, Syncthing handles things a bit differently. With Syncthing, clients connect to each other directly to share files, without anyone in the middle.

So, in essence, every client is itself a server and is talking continuously to all other clients to ensure the integrity of your files. As soon as you make a change to one client, everyone else will start distributing it.

With enough clients, Syncthing works much faster than any other cloud provider ever could. This is happening because your clients are much closer to each other (often on the same local network and/or ISP), than Google/Apple servers, even with CDNs. For example, using a 1GB/s wifi router will give you a tremendous amount of speed (your hard drives will likely be slower).

How to setup Syncthing

Syncthing currently works on all desktop OSes (Windows/Mac/Unix-like) and Android. Unfortunately, there is no support for IOS at the moment due to platform restrictions. So here are the instructions to set it up on all 4 platforms:

Windows

Firstly, download the Windows version from here. This is a GUI wrapper on top of Syncthing (which is a command-line utility) that makes it easier for new users. After you install it, this is the window you should be seeing:

Now continue to the Usage section.

macOS

There is a different wrapper for macOS, which is available here. Once you install it, the GUI should be pretty much the same as on Windows. Continue to the Usage section.

Linux

Of course, we are going to use the bare command-line utility for Linux, I am assuming that is why you use it. Head out to this page find packages for your distro of choice.

Now, to make it start up automatically, you need to enable the systemd service. If you are setting this up on a server, use these commands:

systemctl --user enable syncthing.service
systemctl --user start syncthing.service

If you are setting this up on your workstation, run this (replace myuser with your username):

systemctl enable [email protected]
systemctl start [email protected]

Note: if you installed Syncthing using binary downloads or sources, it might not have the systemd script installed. In this case, read these.

Since there is no wrapper, to access the Syncthing’s GUI you need to visit http://localhost:8384/. On this page, you will find the same interface as on Windows or macOS.

Android

On Android, you are looking for this app on Play Store:

The interface will be slightly different, but still pretty straightforward.

How to use Syncthing

Once you have Syncthing on all clients, we can actually start using it. Firstly, let’s make sure all clients know about each other. In Syncthing GUI, press on Show ID button:

It will present you with client ID that can be copied and a QR code that can be scanned (with a phone). Take that ID and add it on another client using this button:

Repeat this process until all your clients know about each other. Then, on one client, choose a folder to share. To share it, press the Add Folder button:

Now choose a label for your folder and its path. It may already contain files, Syncthing will start sharing them right away. On the Sharing tab, make sure all your clients are selected so they have access to this folder. Once you create it, Syncthing will start propagating it to all clients right away!

Privacy tweaks

These are not required for a general user, but if you care a lot about your privacy, here is how you can secure your setup.

By default, Syncthing will connect to devices directly on local networks. To get the addresses of the other clients, a few mechanisms are used, the one that we are interested in is Global Discovery. Open Settings -> Connections:

Global Discovery means that every client will broadcast its ID and address to Syncthing’s servers, so your clients can find each other. You have 2 approaches here:

  1. Disable global discovery altogether. This will make Syncthing work only on the same local network. If you choose this, look into configuring VPN so your local network is accessible remotely
  2. Use a custom global discovery server. This is the same sever Syncthings runs, but you can self-host it and limit access only to yourself. You may still run only on local network and use VPN for added performance (clients do not have to traverse the network looking for each other), or open the port to use this sever from anywhere where there is internet.

The next option for privacy-sensitive users is relays. It is located in the same place:

Relaying lets your clients talk to each other across networks. This is a middleman, who provides a tunnel from one network to another (data is end-to-end encrypted, so in theory, it will not be able to access it). The options are pretty much the same:

  1. Disable relaying altogether. Syncing will happen only in the same network or VPN
  2. Run a custom relaying server. You can setup 1 relaying server which is accessible from anywhere, and use it as you please. Combined with the custom discovery server, it gives you close to unbreachable security.

Closing notes

Thank you for reading, I hope you liked it. Let me know in the comments about your experience with Syncthing!

Resources

Get new content delivered to your mailbox:

leave a comment