Synchronizing data between computers and mobile devices using Syncthing

In Step

Article from Issue 180/2015
Author(s):

Syncthing is a free alternative to BitTorrent Sync for synchronizing data on computers and mobile devices.

Users have several reasons for synchronizing data between different devices. Synchronization lets you keep directories with the same contents on a workstation and on a laptop, or you can use synchronization to back up a video or music collection.

Popular services like Dropbox, Google Drive, Box, and other providers offer an easy means to synchronize files, but many users aren't comfortable with the privacy concerns associated with public cloud services. An alternative remote synchronization tool is BitTorrent Sync [1], which is based on the BitTorrent protocol's peer-to-peer (P2P) [2] system. Of course, many Linux users want as much Free Software as possible: BitTorrent Sync does not meet this requirement – the program is distributed as freeware, but the source code is not open.

Syncthing [3] (Figure 1) has been available as a free alternative since 2014. Like BitTorrent Sync, Syncthing uses peer-to-peer technology; however, its source code is licensed under the Mozilla Public License [4].

Figure 1: Syncthing only offers a plain web interface natively.

The Syncthing team is constantly developing the software and regularly publishes updates every one or two weeks. As well as both 32- and 64-bit versions of Linux, Syncthing also supports various BSD derivatives, Solaris, Android, Windows, and Mac OS X. An app for iOS will also be released soon.

You can install Syncthing in Arch Linux via the Community repository; the program is also in the repositories of current issues of Fedora and openSUSE. Plans call for integration with Debian, Ubuntu, and their derivatives [5]. Syncthing gets along with ARM CPUs, including the Raspberry Pi, Raspberry Pi 2, and other nano-PCs; and Synology's NAS systems. Syncthing can be found in the Google Play Store [6] or in the open source F-Droid [7] store for Android.

Peer to Peer-to-Peer

Unlike other free cloud-based storage solutions such as ownCloud, Syncthing (like BitTorrent Sync) does not store the uploaded data on a central server; instead, it distributes it to the computers (or nodes if you prefer) participating in the P2P network. The Syncthing team developed the open Block Exchange Protocol [8] for the necessary data exchange. Stringent encryption algorithms ensure that only you as the user can access your data.

Syncthing synchronizes data from the local network and between remote computers. To make this as easy as possible for users outside the home network, the software – like its role model BitTorrent Sync – uses UPnP [9], which you might need to enable on your router. This function should be enabled natively on most routers, and the routers will thus automatically set up the necessary port forwarding. If your router does not offer UPnP, you need to configure port forwarding manually: forward TCP port 22000 to your computer to integrate remote computers. If the computer resides behind a local firewall, forward port 22000/TCP and also UDP port 21025.

First Launch

After installing on your choice of distribution, you can access Syncthing via the menu or in a terminal with normal user rights. The scenario used for this test consisted of a system with Debian "Sid," a laptop with Fedora 22 siduction, and an Android smartphone.

When first launched, Syncthing generates keys and certificates that guarantee a secure exchange of data on the network. The program then automatically opens the web interface in a browser – Syncthing does not natively provide a standard interface. You would have to add this later using Syncthing GTK (Figure 2), if needed. Packages are available for various distributions on GitHub [10]. However, when setting up the packages, you should ensure that the specified dependencies are installed in advance.

Figure 2: You can optionally install a graphical interface using Syncthing GTK.

Configuration

The first steps assume that you are starting Syncthing on all nodes (i.e., all computers belonging to the network). The first step is to organize the web interface settings, which you can access via the cogwheel icon at the top right on the web page (Figure 3). Pay particular attention to the sub-items Settings and Show ID.

Figure 3: You can restrict access to the web interface in the settings.

Next, enter a unique Device Name in Settings; Syncthing uses the device's hostname by default. You can also limit the data rates here if you need to be sparing with your Internet connection's bandwidth. The default 0 uses all available bandwidth. If available, Enable UPnP here and define whether Syncthing should advertise the computer globally and locally. Additionally, switch on HTTPS at this point and enter a username together with a password for the web interface.

Checking Anonymous Usage Reporting sends information to the project about user behavior for the management of development accordingly. The link behind the option conveys more detailed information. You do not need to consider the other options at first. All settings can also be viewed in ~/.config/syncthing/ and edited using a text editor.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More

News