我刚刚安装了 vsftpd,配置如下:
listen=NO
listen_ipv6=YES
anonymous_enable=NO
local_enable=YES
write_enable=YES
dirmessage_enable=YES
use_localtime=YES
xferlog_enable=YES
connect_from_port_20=YES
chroot_local_user=YES
secure_chroot_dir=/var/run/vsftpd/empty
pam_service_name=vsftpd
user_sub_token=$USER
local_root=/home/$USER/ftp
userlist_enable=YES
userlist_file=/etc/vsftpd.user_list
userlist_deny=NO
allow_writeable_chroot=YES
port_enable=YES
pasv_enable=Yes
pasv_address=XX.XX.XX.XX (public ip of router)
pasv_min_port=1100
pasv_max_port=1100
当我尝试在本地建立连接时,它工作正常。但是我无法在本地网络之外进入它。我将路由器 1100 上的端口重定向到本地端口 21。
当我尝试连接时,日志显示正在建立连接,但客户端无法列出目录 /home/$USER/ftp。我尝试使用两个客户端 total commander 和 winscp(结果相同)。
总司令官返回:
Connect to: (02.04.2022 11:48:21)
hostname=XX.XX.XX.XX:1100
username=gryzak
startdir=
XX.XX.XX.XX=XX.XX.XX.XX
220 (vsFTPd 3.0.3)
USER Login
331 Please specify the password.
PASS ***********
230 Login successful.
SYST
215 UNIX Type: L8
FEAT
211-Features:
EPRT
EPSV
MDTM
PASV
REST STREAM
SIZE
TVFS
211 End
HELP SITE
214-The following commands are recognized.
ABOR ACCT ALLO APPE CDUP CWD DELE EPRT EPSV FEAT HELP LIST MDTM MKD
MODE NLST NOOP OPTS PASS PASV PORT PWD QUIT REIN REST RETR RMD RNFR
RNTO SITE SIZE SMNT STAT STOR STOU STRU SYST TYPE USER XCUP XCWD XMKD
XPWD XRMD
214 Help OK.
OPTS UTF8 ON
200 Always in UTF8 mode.
Connect ok!
PWD
257 "/" is the current directory
Download the catalog
TYPE A
200 Switching to ASCII mode.
PORT <Local IP>,202,58
500 Illegal PORT command.
PASV
227 Entering Passive Mode (0,0,0,0,4,76).
Server reports local IP -> Redirect to: XX.XX.XX.XX
Connected to PASV port
LIST
有人知道为什么这些文件夹无法列出吗?
Ubuntu 20.04.4 LTS