Syncthing: Difference between revisions

Nodupe (talk | contribs)
System setup: Added information on how to open the firewall port so syncthing web gui is available through the network.
Lejvin (talk | contribs)
m add requirement for accessing web interface from another computer (bind to 0.0.0.0 instead of 127.0.0.1)
 
(4 intermediate revisions by 3 users not shown)
Line 22: Line 22:
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.
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">
If accessing the web interface from other networked computers you will need to change the gui bind address and open a TCP port:<syntaxhighlight lang="nix">
# Example for /etc/nixos/configuration.nix
services.syncthing = {
  enable = true;
  openDefaultPorts = true; # Open ports in the firewall for Syncthing. (NOTE: this will not open syncthing gui port)
 
  guiAddress = "0.0.0.0:8384"; # By default syncthing only listens to localhost
};
 
# port 8384  is the default port to allow access from the network.
# port 8384  is the default port to allow access from the network.
networking.firewall.allowedTCPPorts = [ 8384 ];
networking.firewall.allowedTCPPorts = [ 8384 ];
Line 42: Line 50:
   };
   };
};
};
</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 51: Line 59:
   enable = true;
   enable = true;
   openDefaultPorts = true;
   openDefaultPorts = true;
  guiPasswordFile = "/etc/syncthing-gui-password";
   settings = {
   settings = {
     gui = {
     gui.user = "myuser";
      user = "myuser";
      password = "mypassword";
    };
     devices = {
     devices = {
       "device1" = { id = "DEVICE-ID-GOES-HERE"; };
       "device1" = { id = "DEVICE-ID-GOES-HERE"; };
Line 73: Line 79:
   };
   };
};
};
</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 151: Line 157:


== Troubleshooting ==
== Troubleshooting ==
=== Some settings not being applied ===
Note the [https://search.nixos.org/options?channel=unstable&show=services.syncthing.settings services.syncthing.settings] option accepts anything that can be parsed into JSON, even if it does not have a corresponding config option. Check the logs of the <code>syncthing-init</code> service with <code>systemctl status syncthing-init.service</code>to see if some settings are not being applied.


== See also ==
== See also ==