227 连接到 vsftpd FTP 服务器时进入被动模式 (0,0,0,0,...)

Art*_*urS 4 ftp virtualbox port-forwarding vsftpd ubuntu

正如标题中所说,我无法将我的 Windows 10 主机连接到 VirtualBox 来宾端(Ubuntu 18.04)上的 FTP 服务器。在来宾端,vsftpd 服务器工作正常,我可以毫无问题地连接。

所以我尝试将关联的端口转发到主机(NAT)并尝试通过 FileZilla 连接到服务器。它确实登录了,但总是无法检索目录列表。我尝试停用防火墙,授予对该文件夹的所有访问权限,但它没有改变任何内容。

我读到这可能是被动模式的问题:
Problems with FTP file access to VirtualBox guest running Windows 2008 Server R2 x64

所以我添加了以下几行到我的vsftpd.conf

pasv_enable=YES
pasv_min_port=8020
pasv_max_port=8020
port_enable=YES
pasv_address=127.0.0.1
Run Code Online (Sandbox Code Playgroud)

我转发了端口 8020,但现在在 FileZilla 上出现以下错误:

无法建立数据连接:WSAEADDRNOTAVAIL - 无法分配请求的地址

完整的 FileZilla 响应:

Status: Connecting to 127.0.0.1:2100...
Status: Connection established, waiting for welcome message...
Status: Server does not support non-ASCII characters.
Status: Logged in
Status: Retrieving directory listing...
Command:    PWD
Response:   257 "/home/cakephp" is the current directory
Command:    TYPE I
Response:   200 Switching to Binary mode.
Command:    PASV
Response:   227 Entering Passive Mode (0,0,0,0,31,84).
Command:    LIST
Error:  The data connection could not be established:
WSAEADDRNOTAVAIL - Cannot assign requested address
Error:  Connection timed out after 20 seconds of inactivity
Error:  Failed to retrieve directory listing
Status: Disconnected from server
Run Code Online (Sandbox Code Playgroud)

我对此有点迷茫,有人有建议吗?提前致谢


EDIT1:
没有任何希望,我也尝试从 Windows 命令提示符访问。它确实连接,但是当我ls进入当前文件夹时,出现以下错误:

500 illegal PORT command.
425 use PORT or PASV first.
Run Code Online (Sandbox Code Playgroud) 但我猜这是因为ftp.exe 不支持被动模式

以防万一,您可以在此处找到我当前的整个 vsftpd 配置文件。此外,我可以使用 Putty 从主机无缝访问来宾 SSH 服务器。

EDIT2:
我设置listen_ipv6YES,改为pasv_max_port8030 以增加被动端口的数量并转发它们。我从 FileZilla 得到以下日志:

Status:  Connecting to 127.0.0.1:2100...
Status: Connection established, waiting for welcome message...
Status: Server does not support non-ASCII characters.
Status: Logged in
Status: Retrieving directory listing...
Command:    PWD
Response:   257 "/home/cakephp" is the current directory
Command:    TYPE I
Response:   200 Switching to Binary mode.
Command:    PASV
Response:   227 Entering Passive Mode (0,0,0,0,31,90).
Command:    LIST
Error:  The data connection could not be established: WSAEADDRNOTAVAIL - Cannot assign requested address
Error:  Connection timed out after 20 seconds of inactivity
Error:  Failed to retrieve directory listing
Run Code Online (Sandbox Code Playgroud)

Mar*_*ryl 8

响应:227 进入被动模式 (0,0,0,0,31,84)。

0,0,0,0很可能是由于 vsftpd 中的一个已知错误。

如果是这种情况,要解决此问题,请确保服务器不侦听 IPv6 地址:

listen_ipv6=NO
listen=YES
Run Code Online (Sandbox Code Playgroud)

有关详细信息,请参阅服务器故障上的类似问题:
即使使用正确的 pasv_address,Vsftpd 被动回复也有 0,0,0,0 地址