Site Logo
mnjm

Sync files between Linux and Android using Syncthing

Posted on 6 mins

Sync Syncthing

In this blog, I’ll guide you through setting up file syncing between Linux and Android using Syncthing. You can also use this pseudo-guide to set up syncing between other types of machines.

What is Syncthing?

Syncthing is an open-source decentralized peer-to-peer file synchronization app built using Go lang, with privacy, security, and user control in mind. Its decentralized approach removes the need for relying on any cloud storage.

Syncthing can operate both on LAN and over the internet. It also comes with very easy-to-use, simple (yet powerful) interface and is supported across various platforms. Syncthing is also available as an app on Android. However, it’s worth noting that iOS is not supported (reason here ).

Here is its FAQ that answers many questions that you may have.

Some details on inner workings of Syncthing

  1. When there is a direct connection between syncing devices, like lets say within a LAN, Syncthing simply connects each device with the other and synchronizes files. When there’s no direct connection, like lets say over the internet, it uses ‘Relay servers’ to bounce traffic between sync devices. Therefore, transfer rates are much lower compared to LAN setting. There are many public relay servers available and maintained by the community. You can also host your own private rely servers too.

  2. So, Syncthing sometimes relies on ‘some server’ to sync. What about privacy, you ask? Well, Syncthing uses end-to-end encryption to securely transfer data. Fear not, your data is protected through the power of crytography, and it’s open source you can vet the source code for leaks, unlike commercial closed-source solutions.

  3. Each device is identified using Syncthing-specific ‘Device IDs,’ which are unique to each device. While these IDs are unique, they are not sensitive. Only in “very” limited scenarios can a device’s IP be reverse-engineered using its ID (when Global discovery is enabled), but it can’t be used to connect to your devices or peek over the curtain.

  4. Syncthing, similar to many torrenting protocols, divides the files into many chunks, and each chunk is synced between devices at a time. So, like torrents, when you have many devices syncing the same files, transfer rates tend to be faster with load sharing.

Steps to setting up Syncthing on Linux and Android

1 Installation

Linux - Ubuntu / Debian based Distributions

Debian-based distributions typically include Syncthing in their apt repositories. To install, simply run sudo apt install syncthing -y. If it’s not available in apt, follow the instructions provided here

Android

Syncthing is available both on Google Play Store and on F-Droid . Install it from one of these stores.

Non Debian Distros

Prominent distros like Arch and Fedora include Syncthing in their package managers, providing an easy installation. In case it’s not available, you can download the binary from Syncthing’s Site , extract it, and manually add it to your PATH.

Windows

Download the installer from Syncthing’s Site and install it like other apps. Grant necessary permissions when prompted, especially firewall permissions.

2 Autostart setup

After installation, on Debian/Ubuntu distros, Syncthing usually doesn’t get added to autostart by default, so you’d have to do it manually. On Windows, as far as I know, the installer takes care of it.

For Android, check the Syncthing app’s optimizations and ensure it has the necessary permissions to autostart.

Steps to add it to Autostart on Linux Mint

I’ve used Linux Mint for this setup, but these steps shouldn’t be much different on other Debian distros like Ubuntu.

7265a2c89e779b2ef8ae2b2e95f56a18.png

3 Configure Syncthing to Sync a folder sync

On Linux

c3823e8a6906cc43831ab12a01f7a471.png

d48be2740265561568be47018c67fa66.png

On Android

Also, make sure to turn off battery optimization for Syncthing. As it’s a file syncing app, it requires full permission to run in the background. Don’t worry; resource usage is minimal unless you’re constantly syncing things.

Android_SS_Rescaled.png

On Linux

Screenshot from 2024-02-21 12-43-37.png

932e7ddea222fa8efc6ba3509db7146f.png

8f1b0f4dd32bb2fad45828dd484457b5.png

In the above screenshots, Linux and Windows represent the labels that I have assigned, not the respective Operating systems

9658d5654d69d857e6d2d3ce1b1c7e1e.png

51dfe4a8eb0c34f67a9521b5a05d673f.png

On Android

411158db5382a7be08fcb468c4c1829a.png

Thats it! you shoud now have sync-folder-in-linux in Linux machine synced with sync-folder-in-android on Android.

Addendum

96bb3ab42a54f9c181ee2974356cfedd.png

References