Summary Files Commits Branches @commit @diff @stats
diff options
context:
space:
mode:
2 files changed, 34 insertions, 1 deletions
-rw-r--r--module-groups.nix2
-rw-r--r--modules/server/ftp.nix33
diff --git a/module-groups.nix b/module-groups.nix
index 0f769f2..7bf9755 100644
--- a/module-groups.nix
+++ b/module-groups.nix
@@ -9,7 +9,7 @@ rec {
];
home-server = minimal-server ++ [
- "samba"
+ "samba" "ftp"
];
};
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=Мрежова папка
+ '';
+ };
+}