Syncthing: Difference between revisions
Cleaned the page |
→Advanced: Don't (implicitly) recommend password in config |
||
| (7 intermediate revisions by 6 users not shown) | |||
| Line 1: | Line 1: | ||
<languages/> | <languages/> | ||
[https://syncthing.net/ Syncthing] is a free and open-source decentralized file synchronization application that | [https://syncthing.net/ Syncthing] is a free and open-source decentralized file synchronization application that allows for secure, continuous, and private syncing of files between computers. Unlike cloud-based services, Syncthing operates peer-to-peer, so your data remains on your devices unless you choose to share it. It is cross-platform, offering native support for Linux, macOS, Windows, BSD, and mobile devices.<ref>https://syncthing.net/</ref> | ||
== Installation == | == Installation == | ||
| Line 15: | Line 15: | ||
To install Syncthing as a system service that runs in the background and survives reboots, add the following to your <code>/etc/nixos/configuration.nix</code>: | To install Syncthing as a system service that runs in the background and survives reboots, add the following to your <code>/etc/nixos/configuration.nix</code>: | ||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"># Example for /etc/nixos/configuration.nix | ||
# Example for /etc/nixos/configuration.nix | |||
services.syncthing = { | services.syncthing = { | ||
enable = true; | enable = true; | ||
openDefaultPorts = true; # Open ports in the firewall for Syncthing | openDefaultPorts = true; # Open ports in the firewall for Syncthing. (NOTE: this will not open syncthing gui port) | ||
}; | };</syntaxhighlight> | ||
Once you've rebuilt your system, Syncthing will be available as a system service. You can visit http://127.0.0.1:8384/ to configure it through the web interface. | |||
If accessing the web interface from other networked computers you will need to open a tcp port:<syntaxhighlight lang="nix"> | |||
# port 8384 is the default port to allow access from the network. | |||
networking.firewall.allowedTCPPorts = [ 8384 ]; | |||
</syntaxhighlight> | </syntaxhighlight> | ||
== Configuration == | == Configuration == | ||
| Line 39: | Line 42: | ||
}; | }; | ||
}; | }; | ||
</syntaxhighlight> | </syntaxhighlight>Note: If you want to use [[Agenix]] to set the GUI password use [https://search.nixos.org/options?channel=unstable&query=syncthing&show=services.syncthing.guiPasswordFile services.syncthing.guiPasswordFile] instead of setting.gui.password. | ||
==== Advanced ==== | ==== Advanced ==== | ||
| Line 48: | Line 51: | ||
enable = true; | enable = true; | ||
openDefaultPorts = true; | openDefaultPorts = true; | ||
guiPasswordFile = "/etc/syncthing-gui-password"; | |||
settings = { | settings = { | ||
gui | gui.user = "myuser"; | ||
devices = { | devices = { | ||
"device1" = { id = "DEVICE-ID-GOES-HERE"; }; | "device1" = { id = "DEVICE-ID-GOES-HERE"; }; | ||
| Line 70: | Line 71: | ||
}; | }; | ||
}; | }; | ||
</syntaxhighlight> | </syntaxhighlight>Note: As per syncthing Device ids are not sensitive and should be okay to keep in your config file.<ref>[https://docs.syncthing.net/users/faq.html#should-i-keep-my-device-ids-secret Should I keep my device IDs secret?]</ref> | ||
== Tips and tricks == | == Tips and tricks == | ||
| Line 142: | Line 143: | ||
=== Disable default sync folder === | === Disable default sync folder === | ||
Syncthing creates a 'Sync' folder in your home directory every time it regenerates a configuration, even if your declarative configuration does not have this folder. You can disable that by | Before version 2.0.0, Syncthing creates a 'Sync' folder in your home directory every time it regenerates a configuration, even if your declarative configuration does not have this folder. You can disable that by using the <code>--no-default-folder</code> command-line option<ref>https://docs.syncthing.net/users/syncthing.html#cmdoption-no-default-folder</ref>: | ||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
services.syncthing.extraFlags = [ "--no-default-folder" ]; # Don't create default ~/Sync folder | |||
</syntaxhighlight> | </syntaxhighlight>The default folder concept is removed in Syncthing 2.0.0 and this flag is no longer available.<ref>https://github.com/syncthing/syncthing/pull/10068</ref> | ||
== Troubleshooting == | == Troubleshooting == | ||
| Line 161: | Line 162: | ||
[[Category:Applications]] | [[Category:Applications]] | ||
[[Category:File synchronization]] | [[Category:File synchronization]] | ||
[[Category:Web | [[Category:Web Applications]] | ||