当前位置:网站首页>Building a full-featured NAS server with raspberry pie (06): built-in file synchronization tool for penetration

Building a full-featured NAS server with raspberry pie (06): built-in file synchronization tool for penetration

2022-06-11 07:15:00 Janvis of the stark family

Write it at the front

That's it nextcloud, We are no longer strangers to personal online disks . But you want to synchronize files anytime, anywhere , Public network is also required IP/ Intranet through .

Actually speaking of file synchronization , There is also a built-in intranet penetration P2P File synchronization tools must be introduced , Namely syncthing.

Imagine , You are in the company / Half the files edited in the lab can still be at home / The seamless connection between the dormitory and the other half of the editor must feel great .

And this time the protagonist is no longer nas, It can be any device on the whole platform . In some synchronization scenarios ( The following is an example ) It will be very easy to use .

Syncthing What is it?

Syncthing Is a free and open source file synchronization tool , The most important thing is based on P2P technology .

 Insert picture description here

The synchronization thus achieved is decentralized , That is, there is no need to have a central server to support the synchronization service . It only needs that both devices are online to complete the synchronization .

The logic of file synchronization is very similar to the nut cloud we mentioned , The usage scenario is similar , But the tools we are introducing now are free from the payment limit , To some extent, there will be a higher degree of freedom . And open source is also important for security .

install

Get into syncthing Of github Project address , Find the boot page :

Community Contributions — Syncthing v1 documentation

You can see that there are many installation methods , Can be installed on many platforms .

You can install synchronization on any device you need , For example, between computers and mobile phones or between computers and computers , It's all right .
 Insert picture description here

Here we mainly talk about installing on the server , use docker-compose.

Open our old friend linuxserver.io, find doc( Pay attention to the version )

image-20210817150950354

The parameters are as follows :

image-20210817151037717

1.PUID and PGID

What each installation says , Fill in after query .

2.path/to/data

Set the directory address mapping of the synchronization file , It can also be modified later

3. Port number

Just keep the default , The default port number is 8384

After setting, you can deploy stack 了 .

 Insert picture description here


Set up

Server side configuration

Use 8384 Ports open Syncthing

image-20210817151913412

First set a password

image-20210817152016366

Then it is the most basic to add a shared folder

image-20210817153201619

To add a folder, you need to set these .

image-20210817152606386

Note here :

1. Folder labels can be used at will , Used to identify

2. Folder ID Is the unique identifier of the share

3. The folder path is the path that we have mapped during installation ( Of course, the new path can also , But you need to map on the server first )

This interface indicates success

image-20210817153132489

Other client configurations

Here we have windows Take the client as an example to demonstrate how to connect to sharing .

First download & Double-click to open SyncTrayzor.

Release Version 1.1.29 · canton7/SyncTrayzor · GitHub

There is no difference between the interface and the server side

image-20210817153542519

Then you need to add a remote device ( Here, you can add it on the server side )

image-20210817153719981

ID It is the long thing with two-dimensional code in the current device , The device name is given by itself .

At this time, the added end will have a confirmation message .

image-20210817153922769

After confirmation, the connection is successful , You can create a shared folder locally .

image-20210817154027146

Be sure to pay attention to this ID To synchronize with the folder you created at that time ID Agreement .

image-20210817154237323

Then check share

image-20210817154350623

Then go back to the server to confirm

image-20210817154500425

Synchronous success !

image-20210817154729329


Use scenarios

For the shared folders you create ,Syncthing After the connection is confirmed, the contents of the two folders will always be unified , Always consistent . It is very friendly for some scenarios that require multiple processing of office documents .

Similar to the nut cloud , Put files in a shared folder , Then the other devices connected to this folder can get a copy .

Of course , The synchronization time should be determined according to your network environment . LAN to LAN is definitely the fastest , The external network needs to use its own internal network penetration .

Basic usage :

1. You can sync your phone directly with your computer , You can also synchronize between computers .

2. But if you want to share your files elsewhere at home , It means that the devices on both sides must be turned on to connect successfully .(P2P Why )

3. You can use the server as an intermediary , Two by two , In this way, the left and right devices do not need to be turned on at any time .( Of course, the server should do a good job in the public network IP/ Intranet penetration should be more comfortable )

4. Use an infrequently used computer as an intermediary , Keep it synchronized .

Other skills

Change specific document requirements

You can change the specific requirements of shared folders in settings

image-20210817155900740

Ignore mode

You can filter folders that do not need to be synchronized ( See the document for the specific use of wildcards )

image-20210817160217890

version control

It is the same as synchronizing cloud disks ,Syncthing It also has version control function .

The version control here is highly selective , You can choose to keep several versions or clear the time interval, and so on .

image-20210817160347821

conflict management

When a file you modify on one device has not yet been synchronized to another device , The file was also modified on another device , This will lead to file conflicts .

At this time Syncthing A new conflict document will be created for you .

image-20210817160720844

You can choose to keep any of these versions .

Summary

Syncthing It can be said that it is a synchronization tool that can solve some practical problems in daily life .

The setup is not complicated , Once and for all , The function is also simple and clear , Especially the usage is very direct , Designed for synchronizing files on both sides , Safe and reliable .

If you don't need a lot of file synchronization at ordinary times , And want to be convenient and fast without being disturbed by various accounts , Then you can try it .

原网站

版权声明
本文为[Janvis of the stark family]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/03/202203020522174489.html