Summary Files Commits Branches @commit @diff @stats
path: root / modules
diff options
context:
space:
mode:
1 files changed, 33 insertions, 0 deletions
-rw-r--r--modules/server/ftp.nix33
diff --git a/modules/server/ftp.nix b/modules/server/ftp.nix
new file mode 100644
index 0000000..4341e56
--- /dev/null
+++ b/modules/server/ftp.nix
@@ -0,0 +1,33 @@
+{
+ networking.firewall.allowedTCPPorts = [ 21 ] ++ /* passive mode ports */ builtins.genList (x: x + 2100) 10;
+ services.vsftpd = {
+ enable = true;
+ writeEnable = true;
+ allowWriteableChroot = true;
+ chrootlocalUser = true;
+
+ anonymousUser = true;
+ anonymousUserNoPassword = true;
+ anonymousUploadEnable = true;
+ anonymousMkdirEnable = true;
+ # Do note, anonymous users cannot write in their home (chroot) directory, period.
+ # The home dir must have non-write permissions and instead there should be a write-able subdirectory inside.
+ anonymousUserHome = "/home/ftp";
+ anonymousUmask = "0";
+
+ extraConfig = ''
+ # Enable passive mode, it seems most GUI tools use it
+ # Thanks https://serverfault.com/a/421169
+ pasv_enable=YES
+ pasv_min_port=2100
+ pasv_max_port=2109
+
+ # More anonymous user permissions
+ anon_world_readable_only=NO
+ anon_other_write_enable=YES
+
+ # Other
+ ftpd_banner=Мрежова папка
+ '';
+ };
+}