Syncthing: a private and secure synchronization tool for Synchronizing files/folders between computers
Introduction
Syncthing is a free open-source tool that can synchronize files/folders between your network computers. Unlike other synchronization tools, such as BitTorrent Sync and Dropbox, the synchronized data is directly transmitted from one system to another, and it is completely open-source, secure and private. All your precious data will be stored in your system, so that you can have full control over your files and folders, no files or folders are stored in a third-party system. In addition, you have the right to decide where the data should be stored, whether to share it with a third party, or how the data is transmitted over the Internet.
All information communication is encrypted using TLS, so that your data can be securely escaped from snoop. Syncthing has a powerful responsive Web Page Management Interface (WebGUI, the same below) that helps you easily add, delete, and manage folders that are synchronized over the network. By using Syncthing, You can synchronize Multiple folders on multiple systems at a time. Syncthing is a portable, simple, and powerful tool for installation and use. When files or folders are directly transmitted from one computer to another, you do not need to consider paying money to the cloud service provider for additional cloud space. All you need is a very stable LAN/WAN connection and enough hard disk space in your system. It supports all modern operating systems, including GNU/Linux, Windows, Mac OS X, and Android.
Install
For the purpose of this article, we will use two systems: Ubuntu 14.04 LTS and Ubuntu 14.10 server. To identify these two systems, we will call them System 1 and System 2 respectively.
System 1 Details:
- Operating System: Ubuntu 14.04 LTS server;
- Host Name: server1.unixmen. local;
- IP Address: 192.168.1.150.
- System User: sk (you can use your own system user)
- Synchronization Folder:/home/Sync/(Syncthing will be created by default)
System 2 details:
- Operating System: Ubuntu 14.10 server;
- Host Name: server. unixmen. local;
- IP Address: 192.168.1.151.
- System User: sk (you can use your own system user)
- Synchronization Folder:/home/Sync/(Syncthing will be created by default)
Create a user for Syncthing on system 1 and System 2
Run the following command on two systems to create a user for Syncthing and a synchronization folder between the two systems.
sudo useradd sk
sudo passwd sk
Install Syncthing for system 1 and System 2
Perform the following steps on system 1 and System 2.
Download the latest version from the official download page. I use the 64-bit version, so I downloaded the 64-bit version of the software package.
wget https://github.com/syncthing/syncthing/releases/download/v0.10.20/syncthing-linux-amd64-v0.10.20.tar.gz
Decompress the downloaded file:
tar xzvf syncthing-linux-amd64-v0.10.20.tar.gz
Switch to the decompressed Folder:
cd syncthing-linux-amd64-v0.10.20/
Copy the executable file "syncthing" to $ PATH:
sudo cp syncthing /usr/local/bin/
Run the following command to run Syncthing for the first time:
syncthing
After you execute the preceding command, syncthing generates a configuration and some configuration key values, and opens a management interface in your browser.
Input example:
[monitor]15:40:27 INFO:Starting syncthing
15:40:27 INFO:Generating RSA key and certificate for syncthing...
[BQXVO]15:40:34 INFO: syncthing v0.10.20(go1.4 linux-386default) unknown-user@syncthing-builder 2015-01-1316:27:47 UTC
[BQXVO]15:40:34 INFO:My ID: BQXVO3D-VEBIDRE-MVMMGJI-ECD2PC3-T5LT3JB-OK4Z45E-MPIDWHI-IRW3NAZ
[BQXVO]15:40:34 INFO:No config file; starting with empty defaults
[BQXVO]15:40:34 INFO:Edit/home/sk/.config/syncthing/config.xml to taste oruse the GUI
[BQXVO]15:40:34 INFO:Starting web GUI on http://127.0.0.1:8080/
[BQXVO]15:40:34 INFO:Loading HTTPS certificate: open /home/sk/.config/syncthing/https-cert.pem:no such file or directory
[BQXVO]15:40:34 INFO:Creatingnew HTTPS certificate
[BQXVO]15:40:34 INFO:Generating RSA key and certificate for server1...
[BQXVO]15:41:01 INFO:StartingUPnP discovery...
[BQXVO]15:41:07 INFO:Startinglocal discovery announcements
[BQXVO]15:41:07 INFO:Startingglobal discovery announcements
[BQXVO]15:41:07 OK:Ready to synchronize default(read-write)
[BQXVO]15:41:07 INFO:Device BQXVO3D-VEBIDRE-MVMMGJI-ECD2PC3-T5LT3JB-OK4Z45E-MPIDWHI-IRW3NAZ is"server1" at [dynamic]
[BQXVO]15:41:07 INFO:Completed initial scan (rw) of folder default
Syncthing has been successfully initialized, And the webpage management interface can also access URL: http: // localhost: 8080 through a browser. As shown in the preceding figure, Syncthing automatically creates a folder named default ** under the Sync directory in your home directory.
By default, the web page management interface of Syncthing can only be accessed on the local port (localhost). to access it remotely, You need to perform the following operations on the two systems:
First, press CTRL + C to terminate the Syncthing initialization process. Now you are back to the terminal interface.
Edit the config. xml file,
sudo nano ~/.config/syncthing/config.xml
Find the following command:
[...]
<gui enabled="true" tls="false">
<address>127.0.0.1:8080</address>
<apikey>-Su9v0lW80JWybGjK9vNK00YDraxXHGP</apikey>
</gui>
[...]
In the region, change 127.0.0.1: 8080 to 0.0.0.0: 8080. As a result, your config. xml looks like this:
<guienabled="true"tls="false">
<address>0.0.0.0:8080</address>
<apikey>-Su9v0lW80JWybGjK9vNK00YDraxXHGP</apikey>
</gui>
Save and close the file.
Execute the following command again on the two systems:
syncthing
Access the webpage management interface
Now, open http: // ip-address: 8080/in your browser /. You will see the following interface:
The webpage management interface is divided into two tabs. In the left pane, you can see the list of synchronized folders. As mentioned above, folder default is automatically created when you initialize Syncthing. If you want to synchronize more folders, click Add Folder.
In the right pane, you can see the number of connected devices. Now there is only one computer that you are working on.
Configure Syncthing on the web page
To improve security, enable TLS and set the administrator user and password for accessing the webpage management interface. To do this, click the gear button in the upper right corner and select Settings
Enter the account name/password of the Administrator. I set admin/Ubuntu. You should use more complex passwords.
Click Save. Now, you are asked to restart Syncthing to make the change take effect. Click Restart.
Refresh your web browser. You can see an SSL warning like below. Click the button that shows I understand the Risks. Then, click "Add Exception" to Add the current page to the Trust List of the browser.
Enter the administrator user and password set in the previous step. I set admin/ubuntu.
Now, we have improved the security of the web page management interface. Do not forget to perform the same steps on both systems.
Connect to other servers
To synchronize files between systems, you must tell them the information of other servers. This is achieved by switching the device IDs. You can find it by selecting "Show ID" in "gear menu" (in the upper right corner.
For example, the following is the ID of system 1.
Copy this ID and go to the webpage management interface of another system (System 2). Click Add Device in the right pane.
The following interface is displayed. Paste System 1 ID ** in the Device area **. Enter the device name (optional ). In the address area, you can enter the IP address of another system (LCTT: the system to which the pasted ID belongs, this should be System 1), or use the default value. The default value is dynamic. Finally, select the folder to be synchronized. In our example, the synchronization folder is default **.
Click save. You will be asked to restart Syncthing. Click Restart to make the change take effect.
Now, go to system 1's webpage management interface and you will see the connection and synchronization requests from system 2. Click Add. Now, system 2 requires system 1 to share and synchronize folders named default.
Restart the Syncthing service of system 1 to make the change take effect.
Wait about 60 seconds. Then you will see that the two systems have been successfully connected and synchronized.
You can check this situation in the Add Device area on the webpage management interface.
After System 2 is added, the control window in system 1 web page management interface is as follows:
After System 1 is added, the control window in the webpage management interface of System 2 is as follows:
Now, put any file or folder in the "default" folder of any system. You can see that these files/folders are automatically synchronized to other systems.
This article is complete! Happy synchronization!
Thank you !!!
Via: http://www.unixmen.com/syncthing-private-secure-tool-sync-filesfolders-computers/
Author: SK Translator: XLCYun Proofreader: wxy
This article was originally translated by LCTT and launched with the Linux honor in China
This article permanently updates the link address: