Syncthing Synology Package

broken image


  1. Qnap Syncthing
  2. Syncthing Windows 10
  3. Syncthing Synology Package Manager

Jump to configuration for your system:

AirConnect package for Synology NAS and Synology Router - bandesz/AirConnect-Synology. I'm trying to make syncthing work on my synology nas, the problem is. Optional: I rebooted because I didn't know the port for the package, it's port. The official Debian/Ubuntu Syncthing repository, and several distros (including Arch Linux) ship these service files along with the Syncthing package.

Windows¶

There is currently no official installer available for Windows. However,there are a number of easy solutions.

Built-in solutions:

Other solutions:

Run at user log on or at system startup using Task Scheduler¶

Task Scheduler is a built-in administrative tool, which can be used tostart Syncthing automatically either at user log on, or at systemstartup. In both cases, Syncthing will open and stay invisible inbackground.

For technical information about Task Scheduler visithttps://docs.microsoft.com/windows/win32/taskschd.

  1. Start the Task Scheduler either by going to StartMenu>WindowsAdministrativeTools and clicking on TaskScheduler, or byopening taskschd.msc from the Run command (Win+R).

  2. Create a new Task ('Actions' sidebar > 'Create Task…').

  3. General tab:

    1. Name the task (for example 'Syncthing').

    2. Select 'Run whether user is logged on or not'. Utc 23 59 to pst.

  4. Triggers tab:

    Syncthing can be set up to start either at user log on, or at systemstartup. Pick your preferred method and follow the instructionsbelow. If unsure, read the explanations underneath each of the twooptions.

    • Run at user log on

      Choose this option if you intend to use Syncthing only when beinglogged on to your Windows user account.

      1. Click 'New…'.

      2. Set 'Begin the task:' to 'At log on'.

      3. Select 'Specific user:'

      4. Click 'OK'.

    • Run at system startup

      Choose this option if you want Syncthing to open in background assoon as Windows starts, and even when not being logged on to youruser account. Do not use this method if your Syncthing folders arestored on a non-system partition protected by BitLocker, as theywill be inaccessible before user log on.

      1. Click 'New…'.

      2. Set 'Begin the task:' to 'At startup'.

      3. Click 'OK'.

  5. Actions tab:

    1. Click 'New…'.

    2. Enter the path to syncthing.exe in 'Program/script:' (forexample C:syncthingsyncthing.exe).

    3. Enter -no-console-no-browser in 'Add arguments (optional):'

    4. Click 'OK'.

  6. Settings tab:

    1. Uncheck 'Stop task if it runs longer than:'.

    2. Click OK.

    3. Enter password for the user.

Additional configuration in Task Scheduler¶

The following settings are optional. They are not required for Syncthingto run properly, but can offer additional functionality. Feel free tomake selective use of them depending on your needs.

  1. Conditions Tab:

    • Uncheck 'Stop if the computer switches to battery power'. Note thatunchecking 'Start the task only if the computer is on AC power'does not disable this option. Even if greyed out, it still applies,and has to be unchecked separately.

    • Uncheck 'Start the task only if the computer is on AC power'.

    • Check 'Start only if the following network connection is available'and set to 'Network'. Use this option on a laptop, when you wantSyncthing to start only on a wired Internet connection, and not onWi-Fi. Note that once started, Syncthing will not stop running ifthe connection changes or becomes unavailable later.

  2. Actions Tab:

    1. Select the previously created action and click 'Edit…'.

    2. Enter the path to the parent folder of syncthing.exe in 'Startin (optional)'. This will allow you to use paths relative to thisfolder in Syncthing.

    3. Click 'OK'.

Warning

Due to technical limitations, ending the task in Task Schedulerterminates only the monitor process of Syncthing. In order to actuallyexit Syncthing, open the Web GUI and press the 'Shutdown' button underthe 'Actions' dropdown menu.

Run at user log on using the Startup folder¶

Starting Syncthing at user log on, without a console window or browseropening on start, is relatively easy.

  1. Copy and paste %APPDATA%MicrosoftWindowsStartMenuProgramsStartupinto the Address Bar in Windows Explorer, and press Enter.

    Alternatively, in newer versions of Windows, open shell:startupfrom the Run command (Win+R).

  2. Right-click empty space in the folder and choose 'New', and then'Shortcut'.

  3. Enter the path to syncthing.exe in 'Type the location of the item:'followed by -no-console-no-browser (for example C:syncthingsyncthing.exe-no-console-no-browser).

  4. Click 'Next'.

  5. Click 'Finish'.

Syncthing will now automatically start the next time you log on to youruser account in Windows. No console or browser window will pop-up, butyou can still access the interface by opening http://localhost:8384 ina Web browser.

Synology

Install and run using third-party tools¶

Qnap Syncthing

There are a number of third-party utilities which aim to help installand run Syncthing more easily. These typically provide an installer,an option to start the program automatically, and a more polished userexperience (e.g. by behaving as a 'proper' Windows application, ratherthan forcing you to start a Web browser to interact with Syncthing).

See also

Windows GUI Wrappers, Cross-platform GUI Wrappers.

Run as a service independent of user login¶

Warning

There are important security considerations with this approach. If you do notsecure Syncthing's GUI (and REST API), then any process running withany permissions can read/write any file on your filesystem, by openinga connection with Syncthing.

Therefore, you must ensure that you set a GUI password, or run Syncthingas an unprivileged user.

With the above configuration, Syncthing only starts when a user logs on to the machine. This is not optimal on servers where a machine canrun long times after a reboot without anyone logged in. In this case itis best to create a service that runs as soon as Windows starts. Thiscan be achieved using NSSM, the 'Non-Sucking Service Manager'.

Note that starting Syncthing on login is the preferred approach foralmost any end-user scenario. The only scenario where running Syncthingas a service makes sense is for (mostly) headless servers, administeredby a sysadmin who knows enough to understand the security implications.

  1. Download and extract nssm to a folder where it can stay. The NSSM executable performs administration as well as executing as the Windows service so it will need to be kept in a suitable location.

  2. From an administrator Command Prompt, CD to the NSSM folder and run nssm.exeinstallservicename>

  3. Application Tab

    • Set Path to your syncthing.exe and enter -no-restart-no-browser-home='toyourSyncthingfolder>' as Arguments. Note: Logging is set later on. -logfile here will not be applied.

  4. Details Tab

    • Optional: Set Startup type to Automatic (Delayed Start) to delay the start of Syncthing when the system first boots, to improve boot speed.

  5. Log On Tab

    • Enter the user account to run Syncthing as. This user needs to have full access to the Syncthing executable and its parent folder, configuration files / database folder and synced folders. You can leave this as Local System but doing so poses security risks. Setting this to your Windows user account will reduce this; ideally create a dedicated user account with minimal permissions.

  6. Process Tab

    • Optional: Change priority to Low if you want a more responsive system at the cost of somewhat longer sync time when the system is busy.

    • Optional: To enable logging enable 'Console window'.

  7. Shutdown Tab

    • To ensure Syncthing is shut down gracefully select all of the checkboxes and set all Timeouts to 10000ms.

  8. Exit Actions Tab

    • Set Restart Action to Stop service (oneshot mode). Specific settings are used later for handling Syncthing exits, restarts and upgrades.

  9. I/O Tab

    • Optional: To enable logging set Output (stdout) to the file desired for logging. The Error field will be automatically set to the same file.

  10. File Rotation Tab

    • Optional: Set the rotation settings to your preferences.

  11. Click the Install Service Button

  12. To ensure that Syncthing exits, restarts and upgrades are handled correctly by the Windows service manager, some final settings are needed. Execute these in the same Command Prompt:

    • nssmsetsyncthingAppExitDefaultExit

    • nssmsetsyncthingAppExit0Exit

    • nssmsetsyncthingAppExit3Restart

    • nssmsetsyncthingAppExit4Restart

  13. Start the service via scstartsyncthing in the Command Prompt.

  14. Connect to the Syncthing UI, enable HTTPS, and set a secure username and password.

Package

macOS¶

Using homebrew¶

  1. brewinstallsyncthing

  2. Follow the information presented by brew to autostart Syncthing using launchctl.

Without homebrew¶

Download and extract Syncthing for Mac:https://github.com/syncthing/syncthing/releases/latest.

  1. Copy the syncthing binary (the file you would open to launchSyncthing) into a directory called bin in your home directory i.e. into /Users//bin. If'bin' does not exist, create it.

  2. Open syncthing.plist located in /etc/macos-launchd. Replace the four occurrences of /Users/USERNAME with your actual home directory location.

  3. Copy the syncthing.plist file to ~/Library/LaunchAgents. Ifyou have trouble finding this location select the 'Go' menu in Finderand choose 'Go to folder…' and then type~/Library/LaunchAgents. Copying to ~/Library/LaunchAgents willrequire admin password in most cases.

  4. Log out and back in again. Or, if you do not want to log out, you canrun this command in terminal:launchctlload~/Library/LaunchAgents/syncthing.plist

Note: You probably want to turn off 'Start Browser' in the web GUIsettings to avoid it opening a browser window on each login. Then, toaccess the GUI type 127.0.0.1:8384 (by default) into Safari.

Syncthing synology package

Linux¶

Using the Desktop Environment (KDE, Gnome, Xfce, Cinnamon, …)¶

You can make Syncthing start when you log into your desktop environment (DE) intwo ways.

Using DE tools:

  1. Search for and launch a tool related to autostart or startup applications.

  2. Add a new autostart application and search for and choose 'Start Syncthing'.

If you don't find 'Start Syncthing' in the steps above or just prefer doing itmanually:

  1. Find the file syncthing-start.desktop: Either from the package youdownloaded from GitHub in etc/linux-desktop/ or in/usr/share/applications/ if installed from your package manager.

  2. Copy syncthing-start.desktop to ~/.config/autostart/.

    We are pleased to introduce the recently released Darkest Dark theme for the Eclipse IDE. This is a fresh new theme designed from the ground up to give you the sharpest contrast and a new set of flat, high-contrast icons. Check out the level of change, from brightest day to darkest dark. This is less stimuli! I created 3 images which contains the exact same 'symbols'. The first two have maximal contrast, pure black and pure white. They are somewhat unpleasant for the eyes and tiring. That last picture has less contrast but is. Darkest Dark Theme with DevStyle. Darkest Dark Theme for Eclipse is A Free Eclipse IDE theme. Eclipse is supposed to be easy to work with, but hours of coding in this IDE can really tire out your eyes. Never fear – there's now a solution to this problem. The Eclipse theme 'Clean Sheet' was developed for an eye-friendly UX. It's a problem that almost every developer faces: tired eyes. Eclipse black theme. Solarized Light looks cool, but personally I use Zenburn: The reason being that it's a dark theme, so it's easier on the eyes at night (and doesn't prevent you from going to sleep as much as a light theme would).

For more information relating to .desktop files e.g. for application menus,refer to https://github.com/syncthing/syncthing/tree/main/etc/linux-desktop.

Using Supervisord¶

Go to /etc/supervisor/conf.d/ and create a new file named syncthing.conf with the following content (ensure you replaced with valid username):

Reload Supervisord:

Then start it:

and check it is all working:

In case of troubles check the logs:

Using systemd¶

systemd is a suite of system management daemons, libraries, andutilities designed as a central management and configuration platformfor the Linux computer operating system. It also offers users theability to manage services under the user's control with a per-usersystemd instance, enabling users to start, stop, enable, and disabletheir own units. Service files for systemd are provided by Syncthing,either in the etc/linux-systemd directory of the downloaded tarballor directly installed to the appropriate location on your system wheninstalled through apt.syncthing.net.

You have two primary options: You can set up Syncthing as a system service, or auser service.

Syncthing Windows 10

Running Syncthing as a system service ensures that Syncthing is run at startupeven if the Syncthing user has no active session. Since the system service keepsSyncthing running even without an active user session, it is intended to be usedon a server.

Running Syncthing as a user service ensures that Syncthing only starts after theuser has logged into the system (e.g., via the graphical login screen, or ssh).Thus, the user service is intended to be used on a (multiuser) desktopcomputer. It avoids unnecessarily running Syncthing instances.

The official Debian/Ubuntu Syncthing repository, andseveral distros (including Arch Linux) ship these service files along withthe Syncthing package. If your distro provides the systemd service files forSyncthing, you can skip step #2 when you're setting up either the system serviceor the user service, as described below.

How to set up a system service¶

  1. Create the user who should run the service, or choose an existing one.

  2. From git location mentioned above copy the Syncthing/etc/linux-systemd/system/syncthing@.service file into theload path of the system instance.

  3. Enable and start the service. Replace 'myuser' with the actual Syncthinguser after the @:

How to set up a user service¶

Syncthing Synology Package Manager

  1. Create the user who should run the service, or choose an existingone. Probably this will be your own user account.

  2. Copy the Syncthing/etc/linux-systemd/user/syncthing.service file into the load pathof the user instance.To do this without root privileges you can just use this folder under yourhome directory: ~/.config/systemd/user/.

  3. Enable and start the service:

  4. If your home directory is encrypted with eCryptfs on Debian/Ubuntu, then you will need to makethe change described in Ubuntu bug 1734290.Otherwise the user service will not start, because by default, systemd checks for userservices before your home directory has been decrypted.

Checking the service status¶

To check if Syncthing runs properly you can use the statussubcommand. To check the status of a system service:

To check the status of a user service:

Using the journal¶

Systemd logs everything into the journal, so you can easily access Syncthing logmessages. In both of the following examples, -e tells the pager to jump tothe very end, so that you see the most recent logs.

To see the logs for the system service:

To see the logs for the user service:

Permissions¶

If you enabled the IgnorePermissions option in the Syncthing client'sfolder settings, then you will also need to add the line UMask=0002 (or anyother umask setting you like) in the[Service] section of the syncthing@.service file.

Debugging¶

If you are asked on the bugtracker to start Syncthing with specificenvironment variables it will not work the normal way. Systemd isolates eachservice and it cannot access global environment variables. The solution is toadd the variables to the service file instead.

To edit the system service, run:

To edit the user service, run:

Package

Install and run using third-party tools¶

Qnap Syncthing

There are a number of third-party utilities which aim to help installand run Syncthing more easily. These typically provide an installer,an option to start the program automatically, and a more polished userexperience (e.g. by behaving as a 'proper' Windows application, ratherthan forcing you to start a Web browser to interact with Syncthing).

See also

Windows GUI Wrappers, Cross-platform GUI Wrappers.

Run as a service independent of user login¶

Warning

There are important security considerations with this approach. If you do notsecure Syncthing's GUI (and REST API), then any process running withany permissions can read/write any file on your filesystem, by openinga connection with Syncthing.

Therefore, you must ensure that you set a GUI password, or run Syncthingas an unprivileged user.

With the above configuration, Syncthing only starts when a user logs on to the machine. This is not optimal on servers where a machine canrun long times after a reboot without anyone logged in. In this case itis best to create a service that runs as soon as Windows starts. Thiscan be achieved using NSSM, the 'Non-Sucking Service Manager'.

Note that starting Syncthing on login is the preferred approach foralmost any end-user scenario. The only scenario where running Syncthingas a service makes sense is for (mostly) headless servers, administeredby a sysadmin who knows enough to understand the security implications.

  1. Download and extract nssm to a folder where it can stay. The NSSM executable performs administration as well as executing as the Windows service so it will need to be kept in a suitable location.

  2. From an administrator Command Prompt, CD to the NSSM folder and run nssm.exeinstallservicename>

  3. Application Tab

    • Set Path to your syncthing.exe and enter -no-restart-no-browser-home='toyourSyncthingfolder>' as Arguments. Note: Logging is set later on. -logfile here will not be applied.

  4. Details Tab

    • Optional: Set Startup type to Automatic (Delayed Start) to delay the start of Syncthing when the system first boots, to improve boot speed.

  5. Log On Tab

    • Enter the user account to run Syncthing as. This user needs to have full access to the Syncthing executable and its parent folder, configuration files / database folder and synced folders. You can leave this as Local System but doing so poses security risks. Setting this to your Windows user account will reduce this; ideally create a dedicated user account with minimal permissions.

  6. Process Tab

    • Optional: Change priority to Low if you want a more responsive system at the cost of somewhat longer sync time when the system is busy.

    • Optional: To enable logging enable 'Console window'.

  7. Shutdown Tab

    • To ensure Syncthing is shut down gracefully select all of the checkboxes and set all Timeouts to 10000ms.

  8. Exit Actions Tab

    • Set Restart Action to Stop service (oneshot mode). Specific settings are used later for handling Syncthing exits, restarts and upgrades.

  9. I/O Tab

    • Optional: To enable logging set Output (stdout) to the file desired for logging. The Error field will be automatically set to the same file.

  10. File Rotation Tab

    • Optional: Set the rotation settings to your preferences.

  11. Click the Install Service Button

  12. To ensure that Syncthing exits, restarts and upgrades are handled correctly by the Windows service manager, some final settings are needed. Execute these in the same Command Prompt:

    • nssmsetsyncthingAppExitDefaultExit

    • nssmsetsyncthingAppExit0Exit

    • nssmsetsyncthingAppExit3Restart

    • nssmsetsyncthingAppExit4Restart

  13. Start the service via scstartsyncthing in the Command Prompt.

  14. Connect to the Syncthing UI, enable HTTPS, and set a secure username and password.

macOS¶

Using homebrew¶

  1. brewinstallsyncthing

  2. Follow the information presented by brew to autostart Syncthing using launchctl.

Without homebrew¶

Download and extract Syncthing for Mac:https://github.com/syncthing/syncthing/releases/latest.

  1. Copy the syncthing binary (the file you would open to launchSyncthing) into a directory called bin in your home directory i.e. into /Users//bin. If'bin' does not exist, create it.

  2. Open syncthing.plist located in /etc/macos-launchd. Replace the four occurrences of /Users/USERNAME with your actual home directory location.

  3. Copy the syncthing.plist file to ~/Library/LaunchAgents. Ifyou have trouble finding this location select the 'Go' menu in Finderand choose 'Go to folder…' and then type~/Library/LaunchAgents. Copying to ~/Library/LaunchAgents willrequire admin password in most cases.

  4. Log out and back in again. Or, if you do not want to log out, you canrun this command in terminal:launchctlload~/Library/LaunchAgents/syncthing.plist

Note: You probably want to turn off 'Start Browser' in the web GUIsettings to avoid it opening a browser window on each login. Then, toaccess the GUI type 127.0.0.1:8384 (by default) into Safari.

Linux¶

Using the Desktop Environment (KDE, Gnome, Xfce, Cinnamon, …)¶

You can make Syncthing start when you log into your desktop environment (DE) intwo ways.

Using DE tools:

  1. Search for and launch a tool related to autostart or startup applications.

  2. Add a new autostart application and search for and choose 'Start Syncthing'.

If you don't find 'Start Syncthing' in the steps above or just prefer doing itmanually:

  1. Find the file syncthing-start.desktop: Either from the package youdownloaded from GitHub in etc/linux-desktop/ or in/usr/share/applications/ if installed from your package manager.

  2. Copy syncthing-start.desktop to ~/.config/autostart/.

    We are pleased to introduce the recently released Darkest Dark theme for the Eclipse IDE. This is a fresh new theme designed from the ground up to give you the sharpest contrast and a new set of flat, high-contrast icons. Check out the level of change, from brightest day to darkest dark. This is less stimuli! I created 3 images which contains the exact same 'symbols'. The first two have maximal contrast, pure black and pure white. They are somewhat unpleasant for the eyes and tiring. That last picture has less contrast but is. Darkest Dark Theme with DevStyle. Darkest Dark Theme for Eclipse is A Free Eclipse IDE theme. Eclipse is supposed to be easy to work with, but hours of coding in this IDE can really tire out your eyes. Never fear – there's now a solution to this problem. The Eclipse theme 'Clean Sheet' was developed for an eye-friendly UX. It's a problem that almost every developer faces: tired eyes. Eclipse black theme. Solarized Light looks cool, but personally I use Zenburn: The reason being that it's a dark theme, so it's easier on the eyes at night (and doesn't prevent you from going to sleep as much as a light theme would).

For more information relating to .desktop files e.g. for application menus,refer to https://github.com/syncthing/syncthing/tree/main/etc/linux-desktop.

Using Supervisord¶

Go to /etc/supervisor/conf.d/ and create a new file named syncthing.conf with the following content (ensure you replaced with valid username):

Reload Supervisord:

Then start it:

and check it is all working:

In case of troubles check the logs:

Using systemd¶

systemd is a suite of system management daemons, libraries, andutilities designed as a central management and configuration platformfor the Linux computer operating system. It also offers users theability to manage services under the user's control with a per-usersystemd instance, enabling users to start, stop, enable, and disabletheir own units. Service files for systemd are provided by Syncthing,either in the etc/linux-systemd directory of the downloaded tarballor directly installed to the appropriate location on your system wheninstalled through apt.syncthing.net.

You have two primary options: You can set up Syncthing as a system service, or auser service.

Syncthing Windows 10

Running Syncthing as a system service ensures that Syncthing is run at startupeven if the Syncthing user has no active session. Since the system service keepsSyncthing running even without an active user session, it is intended to be usedon a server.

Running Syncthing as a user service ensures that Syncthing only starts after theuser has logged into the system (e.g., via the graphical login screen, or ssh).Thus, the user service is intended to be used on a (multiuser) desktopcomputer. It avoids unnecessarily running Syncthing instances.

The official Debian/Ubuntu Syncthing repository, andseveral distros (including Arch Linux) ship these service files along withthe Syncthing package. If your distro provides the systemd service files forSyncthing, you can skip step #2 when you're setting up either the system serviceor the user service, as described below.

How to set up a system service¶

  1. Create the user who should run the service, or choose an existing one.

  2. From git location mentioned above copy the Syncthing/etc/linux-systemd/system/syncthing@.service file into theload path of the system instance.

  3. Enable and start the service. Replace 'myuser' with the actual Syncthinguser after the @:

How to set up a user service¶

Syncthing Synology Package Manager

  1. Create the user who should run the service, or choose an existingone. Probably this will be your own user account.

  2. Copy the Syncthing/etc/linux-systemd/user/syncthing.service file into the load pathof the user instance.To do this without root privileges you can just use this folder under yourhome directory: ~/.config/systemd/user/.

  3. Enable and start the service:

  4. If your home directory is encrypted with eCryptfs on Debian/Ubuntu, then you will need to makethe change described in Ubuntu bug 1734290.Otherwise the user service will not start, because by default, systemd checks for userservices before your home directory has been decrypted.

Checking the service status¶

To check if Syncthing runs properly you can use the statussubcommand. To check the status of a system service:

To check the status of a user service:

Using the journal¶

Systemd logs everything into the journal, so you can easily access Syncthing logmessages. In both of the following examples, -e tells the pager to jump tothe very end, so that you see the most recent logs.

To see the logs for the system service:

To see the logs for the user service:

Permissions¶

If you enabled the IgnorePermissions option in the Syncthing client'sfolder settings, then you will also need to add the line UMask=0002 (or anyother umask setting you like) in the[Service] section of the syncthing@.service file.

Debugging¶

If you are asked on the bugtracker to start Syncthing with specificenvironment variables it will not work the normal way. Systemd isolates eachservice and it cannot access global environment variables. The solution is toadd the variables to the service file instead.

To edit the system service, run:

To edit the user service, run:

This will create an additional configuration file automatically and youcan define (or overwrite) further service parameters like e.g.Environment=STTRACE=model.





broken image