在NAT之后的proFTPd w / MySQL Auth – 无法检索目录列表

我正在我的CentOS Linux虚拟机(这是后面的NAT)上运行proFTPd。

这是我到目前为止的proftpd.confconfiguration: http : proftpd.conf

当我连接到FileZilla客户端的FTP帐户时,我得到以下内容:

 Status: Connecting to 109.xxx.xx.xxx:2121... Status: Connection established, waiting for welcome message... Response: 220 FTP Server Ready. Command: USER exampleuser Response: 331 Password required for exampleuser Command: PASS ****** Response: 230 User exampleuser logged in Command: SYST Response: 215 UNIX Type: L8 Command: FEAT Response: 211-Features: Response: MDTM Response: MFMT Response: LANG ja-JP;ko-KR;bg-BG;zh-TW;en-US;ru-RU;it-IT;fr-FR;zh-CN Response: TVFS Response: UTF8 Response: MFF modify;UNIX.group;UNIX.mode; Response: MLST modify*;perm*;size*;type*;unique*;UNIX.group*;UNIX.mode*;UNIX.owner*; Response: REST STREAM Response: SIZE Response: 211 End Command: OPTS UTF8 ON Response: 200 UTF8 set to on Status: Connected Status: Retrieving directory listing... Command: PWD Response: 257 "/" is the current directory Command: TYPE I Response: 200 Type set to I Command: PASV Response: 227 Entering Passive Mode (109,xxx,xx,xxx,237,74). Command: MLSD Error: Connection timed out Error: Failed to retrieve directory listing 

我已经查看/var/log/proftpd/文件夹,它是空的。

我在这个文件/var/log/messages发现了以下内容:

 Oct 29 12:34:33 mageDev proftpd[27542]: 127.0.0.1 - ProFTPD killed (signal 15) Oct 29 12:34:33 mageDev proftpd[27542]: 127.0.0.1 - ProFTPD 1.3.3g standalone mode SHUTDOWN Oct 29 12:34:34 mageDev proftpd[27560]: 127.0.0.1 - ProFTPD 1.3.3g (maint) (built Sat Sep 14 2013 20:13:10 UTC) standalone mode STARTUP Oct 29 12:34:53 mageDev proftpd[27562]: 127.0.0.1 (::ffff:46.xx.xxx.xx[::ffff:46.xx.xxx.xx]) - FTP session opened. Oct 29 12:34:53 mageDev proftpd[27562]: 127.0.0.1 (::ffff:46.xx.xxx.xx[::ffff:46.xx.xxx.xx]) - Preparing to chroot to directory '/ftp/exampleuser' 

我如何诊断这个错误/问题? 为什么抛出错误Failed to retrieve directory listing

这是这个exampleuser的服务器文件夹:

在这里输入图像说明

我意识到类似这样的问题已经在这里问: proftpd,dynamicIP和filezilla:端口麻烦

不像这个用户,如果我删除我的MasqueradeAddress我得到这个警告,仍然是相同的错误:

 Status: Server sent passive reply with unroutable address. Using server address instead. Command: LIST Error: Connection timed out Error: Failed to retrieve directory listing 

您会收到“无法检索目录列表”错误消息,因为FTP客户端不能从服务器获取目录列表,很可能是由于防火墙或networking问题。

FTP协议是在networking防火墙和networking地址转换之前就发明的,它使用单独的命令通道和数据通道进行通信。

login时,只有命令通道正在使用中。

在执行目录列表时,客户端和服务器在命令通道上告诉对方需要dynamic设置数据通道的IP地址和端口(在本例中为60746),以传输目录列表数据。

这是通过FTP命令PORT或PASV完成的。

在你的情况下,客户端发出PASV命令,服务器回复: 227 Entering Passive Mode (109,xxx,xx,xxx,237,74).

括号内的前4个字节是IP地址,后两个是端口号(256 * 237 + 74 = 60746)。

您是否在虚拟机中运行FTP服务器,并为虚拟机configuration了一个NATnetworking适​​配器(而不是Bridged )? 那么这很可能是您的问题的原因,因为这些types的VM通常无法从“外部”访问,因为它们共享物理主机的IP地址。

端口60000-65535是否在服务器上打开? 您的configuration指定用于被动连接的范围。 您可以将其缩小到更短的范围,以便在防火墙中需要更less的开放端口。

1)确保您的虚拟机以Bridgednetworking模式运行,以便从路由器的NAT获得IP,并且您没有NAT两次。

2)您必须启用ProFTPdconfiguration中的MasqueradeAddress选项,并在那里input您的公共IP(请尝试whatismyip.com )

3)您必须在ProFTPdconfiguration中取消注释被动端口选项。 它有两个数字,他们应该形成一个范围从 – 到。 如果你想的话,你可以使范围更小。

3)您必须将以下端口从路由器转发到相应的FTP VM端口:20,21和全部被动端口范围。