Linux

How to Set Up and Use Syncthing on Linux for File Syncing

How to Set Up and Use Syncthing on Linux for File Syncing

Syncthing is a powerful open-source tool that allows you to synchronize files across multiple devices seamlessly. Unlike cloud services, Syncthing enables you to maintain control over your data, as it operates on a peer-to-peer model. In this guide, we will walk you through the process of setting up Syncthing on a Linux system and provide tips for effective usage.

Prerequisites
Before you begin, ensure that you have the following:

  • A Linux-based operating system (Ubuntu, Fedora, Debian, etc.).
  • Sudo or root privileges to install software.
  • Basic familiarity with the command line.

Step 1: Install Syncthing
For Debian/Ubuntu-based systems:
Update your package list:

Open your terminal and run the following command:

sudo apt update

Install Syncthing:

Syncthing can be installed from the official repository. Use the following command:

sudo apt install syncthing

For Fedora:
Install Syncthing:

Run the following command:

sudo dnf install syncthing

For Arch Linux:
Install Syncthing:

Use the command:

sudo pacman -S syncthing

After installation, you can start Syncthing using the command syncthing.

Step 2: Start Syncthing
You can start Syncthing manually in your terminal:

syncthing

By default, Syncthing runs as a background process. If you want it to start automatically at system startup, you can set it up as a service.

Setting Syncthing as a Systemd Service
Create a Syncthing service file:

Create a new service file in the systemd directory:

sudo nano /etc/systemd/system/syncthing.service

Add the following content:

[Unit]
Description=Syncthing – Open Source Continuous File Synchronization
Documentation=https://docs.syncthing.net/
After=network-online.target

[Service]
User=YOUR_USERNAME
ExecStart=/usr/bin/syncthing
Restart=on-failure
Environment=STNORESTART=1

[Install]
WantedBy=multi-user.target

Make sure to replace YOUR_USERNAME with your actual username.

Enable and start the service:

Run these commands to enable Syncthing to start on boot and to start the service immediately:

sudo systemctl enable syncthing
sudo systemctl start syncthing

Step 3: Access the Web GUI
Syncthing provides a web-based interface for easy management. By default, it runs on port 8384. Open your web browser and navigate to:

http://localhost:8384

Here, you will find the user interface to configure your synchronization settings.

Step 4: Add Devices
To sync files between devices, you need to add each device to Syncthing. Here’s how:

Find the Device ID:

  • Each Syncthing instance has a unique Device ID displayed on the web interface.

Add Device:

  • On your web interface, click on “Add Remote Device.” Enter the Device ID of the other machine you want to sync with and set a name for the device.

Share Folders:

  • After adding a device, you can choose which folders to share. Go to the “Folders” section and click on “Add Folder.” Specify the folder path and give it a label. Then, select the devices with which you want to share this folder.

Step 5: Configure Folder Settings
Syncthing provides several options for configuring folder settings:

  • Folder Path: The local directory you want to sync.
  • Folder ID: A unique identifier for the folder.
  • File Versioning: Options to keep previous versions of files.
  • Rescan Interval: How often Syncthing checks for changes in the folder.
    Adjust these settings according to your needs.

Step 6: Monitor Synchronization Status
The Syncthing web interface provides real-time status updates about the synchronization process. You can view:

  • Sync Status: Whether folders are up-to-date or if there are conflicts.
  • File Transfer Status: The progress of files being transferred between devices.
  • If any issues arise, Syncthing will notify you through the interface, allowing you to troubleshoot effectively.

Step 7: Enable Encryption (Optional)
For added security, you may want to enable TLS encryption. Here’s how:

  • In the web GUI, navigate to Settings.
  • Under the GUI section, enable Use TLS.
  • You can create a self-signed certificate or use a certificate from a trusted certificate authority.

Thank you for visiting our page! Be sure to explore our other article via the link below to boost your Linux expertise. Also, don’t miss our guide on How to Install and Configure Apache Kafka on Ubuntu! 🙂

How to Install and Configure Apache Kafka on Ubuntu

Syncthing official website

 

Related Articles

Leave a Reply

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

Back to top button