I have the following config in vsftpd
listen_ipv6=YES
allow_writeable_chroot=YES
seccomp_sandbox=NO
pam_service_name=vsftpd
userlist_enable=YES
tcp_wrappers=YES
pasv_enable=YES
pasv_min_port=1024
pasv_max_port=1048
pasv_address=<Elastic ip from amazon aws ec2 instance>
pasv_promiscuous=YES
However, when trying to connect to server using FTP I get this following warning,
Status: Retrieving directory listing...
Command: PWD
Response: 257 "/"
Command: TYPE I
Response: 200 Switching to Binary mode.
Command: PASV
Response: 227 Entering Passive Mode (0,0,0,0,4,1).
Status: Server sent passive reply with unroutable address. Using server address instead.
Command: LIST
Response: 150 Here comes the directory listing.
Response: 226 Directory send OK.
Directory listing of "/" successful
If you see it enters the passive mode with this
Entering Passive Mode (0,0,0,0,4,1)
I have no idea where is this coming from (or even what is it). I have SELinux enforcing as well.
What am I doing wrong here ?
Kind Regards, V
It looks like a bug in vsftpd to me.
From the code, it looks like, vsftpd always sends the
0,0,0,0
, if the publicpasv_address
is set, and the server has a (local) IPv6 address.To fix this, make sure the server does not listen on IPv6 address (what is the default behavior, which you are overriding by setting
listen_ipv6=YES
):The only other solution is removing the private IPv6 address, if it is possible in EC2.
Or use another FTP server, e.g. ProFTPD.
To prove that this is indeed a bug:
handle_pasv
inpostlogin.c
:where the
vsf_sysutil_sockaddr_ipv6_v4
returns 0, if thes_p_sockaddr
is not IPv6 (what it never is, when thepasv_address
is set).sysutil.c
:Imho, the code is wrong. It works (and makes sense), when the IP address is "autodetected" from
p_sess->p_local_addr
, but fails, when thepasv_address
address is used.Consider reporting this to the author of vsftpd.
I had this problem with a server hosted on Aliyun.
I solved it by disabling listen_ipv6 and enabling listen in the config.
I also specified my external IP using
pasv_address=