首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >UFW的Ubuntu和SFTP客户端防火墙规则

UFW的Ubuntu和SFTP客户端防火墙规则
EN

Ask Ubuntu用户
提问于 2019-02-25 15:17:40
回答 1查看 15.6K关注 0票数 1

如何在需要访问FTP和SFTP服务器的客户端计算机上设置防火墙规则?

客户端机器上的默认策略是拒绝所有连接(传入和传出)

有一些(UFW)规则允许:

代码语言:javascript
复制
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客户端请求目录树时,出现一个错误:

错误:检索目录列表失败

连接日志:

代码语言:javascript
复制
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连接?

EN

回答 1

Ask Ubuntu用户

发布于 2020-06-12 14:15:45

/etc/proftpd/proftpd.conf

取消标记: PassivePorts 65000 66000 (选择被动端口的范围)

ufw中打开端口的跨度

代码语言:javascript
复制
sudo ufw allow 65000:66000/tcp
票数 3
EN
页面原文内容由Ask Ubuntu提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://askubuntu.com/questions/1121149

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档