Sync files to all your machines
Syncing files to your workstations (MacOS, Linux, Android and Windows) and your NAS. SyncThing works in the background and passing file info between your machines and store it on a NAS. #syncthing
How to share and backup files between many machines. If you are like me and run several machines (2 Desktops, 3 Laptops, 2 Macs, 2 NAS and several OS's Unix, Linux and even Windows) you probably need SyncThing.
SyncThing works in the background and passing file info between your machines and store it on a NAS. You can decide how many copy's and how deep the file tree needs to be. By using the diffs and not storing the whole thing it creates little overhead.
The need to be able to use your file on any machine is paramount to good productivity.
Data is important not the desktop
Different Ways - some Good some not so
- You could use a USB-stick for your data and keep it in your pocket. What it you loose the stick, is it encrypted, can it be opened?
- Send them by e-mail. It works but you need to use secure mail. Do you have secure mail service?
- In a AD environment you can have the desktop on a server and log in on any machine - it's also not so good for a number of reasons.
- Using rsync, freesync with Dropbox or something can be a way but...
- In mixed environments an easy way is using Syncthing. It runs on anything and anywhere
- You want to have end-to-end encrypting and most other solution don't do that to 100%. Syncthing does that.
Installation
You will find the right download at https://syncthing.net/downloads/
Linux setup (Ubuntu/Debian example)
# Add the release PGP keys:
sudo curl -o /usr/share/keyrings/syncthing-archive-keyring.gpg https://syncthing.net/release-key.gpg
# Add the "stable" channel to your APT sources:
echo "deb [signed-by=/usr/share/keyrings/syncthing-archive-keyring.gpg] https://apt.syncthing.net/ syncthing stable" | sudo tee /etc/apt/sources.list.d/syncthing.list
# Update and install syncthing:
sudo apt-get update
sudo apt-get install syncthing
# Enable Syncthing service for username nalle
sudo systemctl enable [email protected]
# Start Syncthing for username nalle
sudo systemctl start [email protected]
Troubleshooting hints at LINK
Start using Syncthing
Now install Syncthing on the other machines and start them up
Start your browser and go to 127.0.0.1:8384 = localhost:8384
You will see all the syncthings you have on the that net (remotes are possible).
- set the password
- note your Identification
- PLAN and execute which machines are to sync and which folders
By default Syncthing uses a directory called /home/username/sync, this might be a valid option for some. I prefer to use the Documents, Pictures and Projects folders. Version control is very important for me. I keep Git out and use GitHub and my local git server for that.
I run desktops on 5 PC's with 4 different OS's and in 3 different languages - no problem what so ever. The basic setup has been running about 5 years now.
Setup your Firewalls
On the Firewall open (default port numbers) see documentation.
- Port 22000/TCP: TCP based sync protocol traffic
- Port 22000/UDP: QUIC based sync protocol traffic
- Port 21027/UDP: for discovery broadcasts on IPv4 and multicasts on IPv6
Tunneling via SSH from a remote location
If you have SSH access to the machine running Syncthing
you might prefer to use a SSH tunnel instead of the web GUI like this:
ssh -L 9999:localhost:8384 machine
and open localhost:9999 in your browser.
Remember to close your terminal and kill the tunnel. [ctrl]+[d]
The benefit is that you do not need to open the web GUI port to the outside world.
How it works
This will bind to your local port 9999 and forward all connections from there to port 8384 on the target machine. This still works even if Syncthing is bound to listen on localhost only.
An alternative
Syncthing can run behind a SOCKS5 proxy. This enables use behind some corporate firewalls, tunneling via SSH, and over Tor. See documentation.
Depending on the use case you could have:
- Recruiting, Policies, Budgets, Documents ....
- Bills, Budgets, Policies, Documents ...
- Settings, Keys, Inventory, Users, Budgets, Documents ...
- Pictures, Articles/New, Articles/Old ...
- Food Blog, IT blog, Management Blog, Documents ...
Version control
You also need to consider which files to exclude and set up a version control policy/policies. All files are not equal at version control and consider do you even want to do syncing on all file types and/or sub-directories.
Don't continue before this stem is fully setup!
Add devices
Click at [+ Add Remote Device] and you will see a list of all devices on the net. (Better to add on at the time). Look for the 6 first character and the should mach your machine.
The rest is self exploratory.
My strategy
All my laptops (Mac, Arch, PopOS) and my desktop syncs between them slightly different sets due to the use case of them. All files are synced to one of my NAS's.
I use version control on many sub-directories, due to the nature of the them.
References
Syncthing [1]