登录后 FTP 超时

登录后 FTP 超时

由于某些原因,我无法通过 FTP 访问我的专用服务器上的任何帐户。它在尝试显示目录​​时超时了。

这是来自 FileZila 的日志...

Status: Resolving address of testdomain.com
Status: Connecting to 64.237.58.43:21...
Status: Connection established, waiting for welcome message...
Response:   220---------- Welcome to Pure-FTPd [TLS] ----------
Response:   220-You are user number 3 of 50 allowed.
Response:   220-Local time is now 19:39. Server port: 21.
Response:   220-This is a private system - No anonymous login
Response:   220-IPv6 connections are also welcome on this server.
Response:   220 You will be disconnected after 15 minutes of inactivity.
Command:    USER testaccount
Response:   331 User testaccount OK. Password required
Command:    PASS ********
Response:   230-User testaccount has group access to:  testaccount
Response:   230 OK. Current restricted directory is /
Command:    SYST
Response:   215 UNIX Type: L8
Command:    FEAT
Response:   211-Extensions supported:
Response:    EPRT
Response:    IDLE
Response:    MDTM
Response:    SIZE
Response:    REST STREAM
Response:    MLST type*;size*;sizd*;modify*;UNIX.mode*;UNIX.uid*;UNIX.gid*;unique*;
Response:    MLSD
Response:    ESTP
Response:    PASV
Response:    EPSV
Response:    SPSV
Response:    ESTA
Response:    AUTH TLS
Response:    PBSZ
Response:    PROT
Response:   211 End.
Status: Connected
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 (64,237,58,43,145,153)
Command:    MLSD
Response:   150 Accepted data connection
Response:   226-ASCII
Response:   226-Options: -a -l 
Response:   226 18 matches total
Error:  Connection timed out
Error:  Failed to retrieve directory listing

我重启了 FTP 服务好几次,但仍然无法加载。只有当我的服务器达到峰值使用率时才会出现这个问题,此时的服务器使用率只有 1.0(4 核),4GB 内存的 40%。

ftp 连接没有达到最大值,因为只有我和我的同事可以访问服务器上的 FTP。

答案1

FTP 是 1971 年推出的协议。它很乱。PASV 模式是一种黑客修复方法,可使其在现代基础设施中运行。很可能您的 PASV 设置已关闭。需要担心的事情:

  • PASV 需要一个需要端口转发的端口范围。因此 FTP 在端口 21 上,但您需要选择 10 个左右的端口进行转发,例如 5110-5120。
  • PASV 需要发送服务器的 IP 地址。通常使用 LAN 地址,但根据您的防火墙设置,可能需要使用 WAN 地址。

也就是说,您最好还是使用 ssh 的 SFTP 协议(​​FTP 很可怕,因为它 100% 未加密)。ssh 只需要在防火墙上打开端口 22,其他什么都不需要。或者使用 Mollify 等基于 Web 的解决方案或 Oliver 等 FTP 的 Web 前端。

答案2

您说这通常有效吗?我们能得到它在正常运行时的日志输出吗?

该目录中有多少个文件?超过 10k 的文件数量将使服务器陷入瘫痪,并在尝试读取整个列表时导致超时。

我的第三个猜测是,也许被动模式通信无法正确穿越防火墙。在其他问题得到解答之前,我不会将其设置为主动模式(如果它通常有效,更改设置只会增加更多变量)。

答案3

此时服务器上的日志是什么样的?

可以尝试的事情:

  • PASV 模式
  • 安全FTP
  • 不同的 FTP 客户端

答案4

我遇到了类似的问题...
尽管我明确设置了“主动”模式,但我的 FTP 连接莫名其妙地进入了被动模式。
我重启了电缆调制解调器和路由器,并修复了这个问题。

相关内容