Debian 12 bookworm
Sponsored Link

Syncthing : Synchronize Files / Directories2025/03/07

 

Copy files or directories from one location to an another localtion by [Syncthing].

This example is based on the environment like follows.

+----------------------+          |          +----------------------+
|     dlp.srv.world    |10.0.0.30 | 10.0.0.51|   node01.srv.world   |
|                      +----------+----------+                      |
|                      |   <------------->   |                      |
+----------------------+        sync         +----------------------+

[1] Install Syncthing on all hosts.
root@dlp:~#
apt -y install syncthing python3-bcrypt
[2] Configure Syncthing with any user on all hosts.
debian@dlp:~$
systemctl --user start syncthing

debian@dlp:~$
systemctl --user stop syncthing
# generate password

debian@dlp:~$
python3 -c 'import bcrypt, getpass; print(bcrypt.hashpw(getpass.getpass().encode(), bcrypt.gensalt()).decode())'

Password:
$2b$12$RXw/VJ1vBm.....
debian@dlp:~$
vi ~/.config/syncthing/config.xml

    # line 45 : change like follows
    <gui enabled="true" tls="true" debugging="false">
        # change to the address this server listens
        <address>10.0.0.30:8384</address>
        # set admin user (any name you like) and generated password
        <user>serverworld</user>
        <password>$2b$12$RXw/VJ1vBm.....</password>
        <apikey>cFdXMg.....</apikey>

        # line 87 : delete the line blow
        <unackedNotificationID>authenticationUserAndPassword</unackedNotificationID>

debian@dlp:~$
systemctl --user start syncthing

[3] On any client computer, go to the configured address of one of your Syncthing hosts and log in with the admin user you configured.
[4] Click [Actions] - [Show ID].
[5] Copy the connection ID that is displayed.
[6] Log in to the other Syncthing host and click [Add Remote Device] in the bottom right.
[7] In the [Device ID] field, enter the connection ID displayed on the other host, and in the [Device Name] field, enter the name of the host to be synchronized (any name), and click the [Save] button.
[8] When you return to the host for which you confirmed the connection ID, a message will appear indicating that a connection request has been made.
Click [Add Device] to add the host to which you want to connect.
[9] You will see the host that has requested a connection. Now go to the [Sharing] tab.
[10] Check the host that requested the connection to synchronize the default folder [/home/(username)/Sync] and click the [Save] button.
[11] When you return to the host that made the connection request, a message will appear indicating that a synchronization request has been made.
Click [Share] to add the folder to be synchronized.
[12] Now that the synchronization setup is complete, add or remove files on both hosts to verify that they are syncing properly.
Matched Content