如何在需要访问FTP和SFTP服务器的客户端计算机上设置防火墙规则?
客户端机器上的默认策略是拒绝所有连接(传入和传出)
有一些(UFW)规则允许:
20/tcp ALLOW OUT Anywhere # FTP Data
21/tcp ALLOW OUT Anywhere # FTP Command
22 ALLOW OUT Anywhere # SSH, SFTP
990 ALLOW OUT Anywhere # FTPS
989 ALLOW OUT Anywhere # FTPS这在连接到FTP/FTPS的客户端机器上运行良好,并在那里进行身份验证,但当ftp客户端请求目录树时,出现一个错误:
错误:检索目录列表失败
连接日志:
Status: Resolving address of xxx.xxx.xxx.xxx
Status: Connecting to 1xx.1xx.2xx.1xx:21...
Status: Connection established, waiting for welcome message...
Status: Initializing TLS...
Status: Verifying certificate...
Status: TLS connection established.
Status: Logged in
Status: Retrieving directory listing...
Command: PWD
Response: 257 "/" is your current location
Command: TYPE I
Response: 200 TYPE is now 8-bit binary
Command: PASV
Response: 227 Entering Passive Mode (1xx,1xx,2xx,1xx,1xx,2xx)
Command: MLSD
Error: Connection timed out after 20 seconds of inactivity
Error: Failed to retrieve directory listing如果关闭防火墙,则没有错误,因此问题与防火墙配置有关。
需要添加哪些规则(最好是UFW规则)才能使防火墙处于默认的不允许规则的情况下,但允许FTP和SFTP连接?
发布于 2020-06-12 14:15:45
在/etc/proftpd/proftpd.conf中
取消标记: PassivePorts 65000 66000 (选择被动端口的范围)
在ufw中打开端口的跨度
sudo ufw allow 65000:66000/tcphttps://askubuntu.com/questions/1121149
复制相似问题