无法以被动模式连接 ftp

无法以被动模式连接 ftp

我尝试连接到我刚刚配置的 ftp,但使用 fileZilla,我得到了以下日志

Status: Connecting to x.x.x.x:21...
Status: Connection established, waiting for welcome message...
Response:   220 (vsFTPd 2.3.5)
Command:    USER huntsnap
Response:   331 Please specify the password.
Command:    PASS ********
Response:   230 Login successful.
Command:    OPTS UTF8 ON
Response:   200 Always in UTF8 mode.
Status: Connected
Status: Retrieving directory listing...
Command:    PWD
Response:   257 "/home/my/home/dir"
Command:    TYPE I
Response:   200 Switching to Binary mode.
Command:    PASV
Response:   227 Entering Passive Mode (10,38,106,212,248,2).
Status: Server sent passive reply with unroutable address. Using server address instead.
Command:    LIST
Error:  Connection timed out
Error:  Failed to retrieve directory listing

我已经在 ubuntu 服务器上配置了 vsftpd,不知道它出了什么问题。

vsftp.conf 文件

listen=YES
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
use_localtime=YES
xferlog_enable=YES
secure_chroot_dir=/var/run/vsftpd/empty
pam_service_name=ftp
rsa_cert_file=/etc/ssl/private/vsftpd.pem
userlist_file=/etc/vsftpd.userlist
userlist_enable=YES
userlist_deny=NO
local_root=/home/to/my/home/
dirlist_enable=YES
download_enable=YES

谢谢

答案1

这是我的 Debian vsftpd 与被动 ftp 相关的配置行:

# Contents of: /etc/vsftpd.conf
pasv_min_port=48900
pasv_max_port=48939

并确保您的防火墙接受 48900:48939 范围的传入 TCP 连接。

实际上您可以选择其他端口范围......

相关内容