Sync Files on your Pis, with Syncthing Learn how to share files between your Raspberry Pis using Syncthing, a secure and private file synchronization tool. 19 April 2024 6 minute read By Kevin McAleer Share this article on Table of Contents What is Syncthing?Installing SyncthingWeb UI ScreenFolders ListThis DeviceRemote DevicesAdding FoldersNoteAdding DevicesGotchas and things to noteConclusion Tags: raspberry pi file syncing syncthing Difficulty: beginner Category: raspberrypi Code: https://gist.github.com/kevinmcaleer/a5571ae18d814ae26ba23c3801670b05 Home Blog Sync files on your pis, with syncthing Sync Files on your Pis, with Syncthing Learn how to share files between your Raspberry Pis using Syncthing, a secure and private file synchronization tool. 19 April 2024 | 6 minute read | By Kevin McAleer | Share this article on Video For every project I create, I often make a corresponding YouTube video. Sometimes, there might be more than one video for a single project. You can find these videos in this section. Explore more through this this dedicated video. If you’ve used Raspberry Pi’s for a while, particularly if you’re looking at using one a as a daily driver, you may find yourself needing to share files between them (and other devices). Most of the popular file syncing apps such as i/cloud, Dropbox, Google Drive, and OneDrive are great, but they’re not always the best solution for syncing files between your Raspberry Pi’s (they aren’t free either, unlike syncthing which is free and open source). Enter Syncthing, a secure and private file synchronization tool that you can use to sync files between your Raspberry Pi’s, and other devices. What is Syncthing? Syncthing is a continuous file synchronization program. It synchronizes files between two or more computers in real time, safely protected from prying eyes. Your data is your data alone and you deserve to choose where it is stored, whether it is shared with some third party, and how it’s transmitted over the internet. Files are stored only on the machines that you choose - they are not stored on a central server, so you can be sure that your files are safe and secure. Installing Syncthing We need to make sure a couple of preequisites are installed on your Raspberry Pi before we can install Syncthing. Launch a terminal window on your Raspberry Pi (you can do this by clicking on the terminal icon in the Raspberry Pi menu). Update our package list: From the termial window, type the following command: sudo apt update Install the apt-transport-https package: From the terminal window, type the following command: sudo apt install apt-transport-https Add the Syncthing repository key: From the terminal window, type the following command: curl -s https://syncthing.net/release-key.txt | gpg --dearmor | sudo tee /usr/share/keyrings/syncthing-archive-keyring.gpg >/dev/null Add the Syncthing repository: From the terminal window, type the following command: 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 our package list again: From the terminal window, type the following command: sudo apt update Install Syncthing: From the terminal window, type the following command: sudo apt install syncthing Start Syncthing You can start Syncthing either by clicking on the Raspberry Pi menu > Internet > Start Syncthing, or by typing the following command in the terminal window: syncthing Launch the Web Interface Once Syncthing has started, you can open a web browser and navigate to http://localhost:8384 to access the Syncthing web interface. There is also a link in the Raspberry Pi Menu > Internet > Syncthing Web UI. You can click yes on the dialog box to share anonymous usage data with the Syncthing project. Its recommended to set a username and password for the web interface, you can do this by clicking on the Actions button in the top right corner of the web interface, and then clicking on Settings. Web UI Screen The name of this computer is shown in the menu bar, at the top left of the screen. Folders List There is a folders list, showing the folders that are either being shared or ready to be shared. This Device This section shows the device ID of the Raspberry Pi (or computer, if no a Pi) you are currently using, along with stats about the number and total size of the files being shared Remote Devices This section shows the device ID of the other Computers that you are sharing files with, along with stats about the number and total size of the files being shared. Adding Folders To add a folder to Syncthing, you’ll need to click on the Add Folder button. Type the path to the folder you want to share with other users in the Folder Path, then click on the Save button. Note If the folder does not exist, Syncthing will create it for you. Adding Devices Adding a remote device and a folder to Syncthing will allow you to share files between your Raspberry Pi’s, and other devices. Log into the other computer you want to share files with, and install Syncthing on that computer. Once Syncthing is installed, you can open a web browser and navigate to http://localhost:8384 to access the Syncthing web interface. You need the long Device ID of the computer you want to share files with. You can find the Device ID by clicking on the Actions button in the top right corner of the web interface, and then clicking on Show ID. Copy this Device ID, and log back into the Raspberry Pi you want to share files with. To add a device to Syncthing, you’ll need to click on the Add Remote Device button. Add the copied Device ID of the remote computer you want to share files with in the Device ID field. Once you’ve entered the Device ID, you’ll need to click on the Save button. Switch back to the computer you want to share files with, and you should see a dialog box asking if you want to add the Raspberry Pi as a remote device, Click Yes. The files should now be shared between the two computers. Gotchas and things to note Syncthing is a great tool for syncing files between your Raspberry Pi’s, and other devices. It’s secure, private, and free, and it’s easy to install and configure. Be sure not to fill up the SD card on your Raspberry Pi with files, as this can cause the Raspberry Pi to slow down, and eventually fail. Syncthing will stop syncronizing files if the SD card is full, or reaches the value set in the Settings menu Its best to use the Synchronised files folder as a transport area, rather than a working folder. If you are working on a file or project with in the Synchronised files folder, it can cause issues as files may be created and removed before Syncthing can detect them and the project may get out of sync. Conclusion Syncthing is a great tool for syncing files between your Raspberry Pi’s, and other devices. It’s secure, private, and free, and it’s easy to install and configure. If you’re looking for a way to sync files between your Raspberry Pi’s, give Syncthing a try! Code View Code Repository on GitHub - https://gist.github.com/kevinmcaleer/a5571ae18d814ae26ba23c3801670b05 Liked this article? You might like these too. Guiding Light Hey Robot Makers! NextCloud You can host your own NextCloud server on your Raspberry Pi, and share files online with your friends and family. Buddy Jr. This project is perfect for beginners who want to get started with robotics and programming. You'll learn how to build a small robot arm using 4 servos and control it with a Raspberry Pi using Python. Robot Arms Extend your reach with these robotic arm projects. From simple pick and place robots to complex inverse kinematics, we have a range of projects to suit all skill levels. TherePi - Music Making with a Raspberry Pi In this project, we will build a theremin using a Raspberry Pi and rangefinders Motion Controlled Arm In this project, we will build a motion controlled robotic arm using a Raspberry Pi and a camera
Sync Files on your Pis, with Syncthing Learn how to share files between your Raspberry Pis using Syncthing, a secure and private file synchronization tool. 19 April 2024 6 minute read By Kevin McAleer Share this article on Table of Contents What is Syncthing?Installing SyncthingWeb UI ScreenFolders ListThis DeviceRemote DevicesAdding FoldersNoteAdding DevicesGotchas and things to noteConclusion Tags: raspberry pi file syncing syncthing Difficulty: beginner Category: raspberrypi Code: https://gist.github.com/kevinmcaleer/a5571ae18d814ae26ba23c3801670b05
If you’ve used Raspberry Pi’s for a while, particularly if you’re looking at using one a as a daily driver, you may find yourself needing to share files between them (and other devices). Most of the popular file syncing apps such as i/cloud, Dropbox, Google Drive, and OneDrive are great, but they’re not always the best solution for syncing files between your Raspberry Pi’s (they aren’t free either, unlike syncthing which is free and open source). Enter Syncthing, a secure and private file synchronization tool that you can use to sync files between your Raspberry Pi’s, and other devices. What is Syncthing? Syncthing is a continuous file synchronization program. It synchronizes files between two or more computers in real time, safely protected from prying eyes. Your data is your data alone and you deserve to choose where it is stored, whether it is shared with some third party, and how it’s transmitted over the internet. Files are stored only on the machines that you choose - they are not stored on a central server, so you can be sure that your files are safe and secure. Installing Syncthing We need to make sure a couple of preequisites are installed on your Raspberry Pi before we can install Syncthing. Launch a terminal window on your Raspberry Pi (you can do this by clicking on the terminal icon in the Raspberry Pi menu). Update our package list: From the termial window, type the following command: sudo apt update Install the apt-transport-https package: From the terminal window, type the following command: sudo apt install apt-transport-https Add the Syncthing repository key: From the terminal window, type the following command: curl -s https://syncthing.net/release-key.txt | gpg --dearmor | sudo tee /usr/share/keyrings/syncthing-archive-keyring.gpg >/dev/null Add the Syncthing repository: From the terminal window, type the following command: 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 our package list again: From the terminal window, type the following command: sudo apt update Install Syncthing: From the terminal window, type the following command: sudo apt install syncthing Start Syncthing You can start Syncthing either by clicking on the Raspberry Pi menu > Internet > Start Syncthing, or by typing the following command in the terminal window: syncthing Launch the Web Interface Once Syncthing has started, you can open a web browser and navigate to http://localhost:8384 to access the Syncthing web interface. There is also a link in the Raspberry Pi Menu > Internet > Syncthing Web UI. You can click yes on the dialog box to share anonymous usage data with the Syncthing project. Its recommended to set a username and password for the web interface, you can do this by clicking on the Actions button in the top right corner of the web interface, and then clicking on Settings. Web UI Screen The name of this computer is shown in the menu bar, at the top left of the screen. Folders List There is a folders list, showing the folders that are either being shared or ready to be shared. This Device This section shows the device ID of the Raspberry Pi (or computer, if no a Pi) you are currently using, along with stats about the number and total size of the files being shared Remote Devices This section shows the device ID of the other Computers that you are sharing files with, along with stats about the number and total size of the files being shared. Adding Folders To add a folder to Syncthing, you’ll need to click on the Add Folder button. Type the path to the folder you want to share with other users in the Folder Path, then click on the Save button. Note If the folder does not exist, Syncthing will create it for you. Adding Devices Adding a remote device and a folder to Syncthing will allow you to share files between your Raspberry Pi’s, and other devices. Log into the other computer you want to share files with, and install Syncthing on that computer. Once Syncthing is installed, you can open a web browser and navigate to http://localhost:8384 to access the Syncthing web interface. You need the long Device ID of the computer you want to share files with. You can find the Device ID by clicking on the Actions button in the top right corner of the web interface, and then clicking on Show ID. Copy this Device ID, and log back into the Raspberry Pi you want to share files with. To add a device to Syncthing, you’ll need to click on the Add Remote Device button. Add the copied Device ID of the remote computer you want to share files with in the Device ID field. Once you’ve entered the Device ID, you’ll need to click on the Save button. Switch back to the computer you want to share files with, and you should see a dialog box asking if you want to add the Raspberry Pi as a remote device, Click Yes. The files should now be shared between the two computers. Gotchas and things to note Syncthing is a great tool for syncing files between your Raspberry Pi’s, and other devices. It’s secure, private, and free, and it’s easy to install and configure. Be sure not to fill up the SD card on your Raspberry Pi with files, as this can cause the Raspberry Pi to slow down, and eventually fail. Syncthing will stop syncronizing files if the SD card is full, or reaches the value set in the Settings menu Its best to use the Synchronised files folder as a transport area, rather than a working folder. If you are working on a file or project with in the Synchronised files folder, it can cause issues as files may be created and removed before Syncthing can detect them and the project may get out of sync. Conclusion Syncthing is a great tool for syncing files between your Raspberry Pi’s, and other devices. It’s secure, private, and free, and it’s easy to install and configure. If you’re looking for a way to sync files between your Raspberry Pi’s, give Syncthing a try!