我想在NixOS主机上运行FTP服务器。我使用vsftpd,但如果有其他更好的选择也可以考虑。
本地主机上的FTP正常工作,但防火墙阻止我进行远程使用。我已允许TCP端口21,但这还不够。
我应该如何配置防火墙以允许FTP连接(包括向FTP服务器写入)?
以下是我目前的代码:
{
networking.firewall = { allowedTCPPorts = [ 20 21 ];
# connectionTrackingModules = [ "ftp" ];
};
services.vsftpd = {
enable = true;
# cannot chroot && write
# chrootlocalUser = true;
writeEnable = true;
localUsers = true;
userlist = [ "martyn" "cam" ];
userlistEnable = true;
};
}
由此可知,任何远程主机使用ftp均失败:
ftp> put dead.letter
200 PORT command successful. Consider using PASV.
425 Failed to establish connection.
使用被动模式(例如ftp -p
)似乎对此没有帮助:
ftp> put dead.letter
227 Entering Passive Mode (192,168,0,7,219,202).
ftp: connect: Connection timed out
在禁用防火墙的一台临时主机上进行测试
networking.firewall.enable = false;
允许使用ftp -p
命令;当然,关闭防火墙并不是一个理想的选择。
感谢任何帮助和指导。
ftp
之外,所有客户端都支持)。 - Martin Prikryl