2

I have been going through different forums and have not been able to resolve this Connection Refused issue with VSFTPD. Here are the details.

VSFTPD.conf

anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022    
connect_from_port_20=YES
chroot_local_user=YES
listen=YES
pam_service_name=vsftpd
userlist_enable=NO
tcp_wrappers=NO
listen_port=18901
local_root=/ftp
log_ftp_protocol=YES
dual_log_enable=YES
pasv_enable=YES
pasv_promiscuous=YES
pasv_max_port=30100
pasv_min_port=30000

IPTables

Chain INPUT (policy ACCEPT)
target     prot opt source               destination
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:21
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp spt:20
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:21 state NEW

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp spt:20
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp spt:21

My server is in AWS. I have a forwarder created which forwards port 21 to 18901. Also, in my AWS security group, I am allowing 21, 18901, 30000-30100.

I have reinstalled VSFTPD multiple times and I have verified the service is running. I also see 18901 listening.

Finally, I can connect locally.

[root@ip-10-0-0-1 /]# ftp
ftp> o 10.0.0.1 18901
Connected to 10.0.0.1(10.0.0.1).
220 (vsFTPd 2.2.2)
Name (10.0.0.1:root): ftp_user
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
227 Entering Passive Mode (10,0,0,1,117,109).
150 Here comes the directory listing.
drwxr-xr-x    1 501      501             0 Jul 21 15:22 file
-rw-r--r--    1 501      501             0 Jul 21 15:21 file.txt
d---------    1 0        0               0 Aug 01 14:59 pws
226 Directory send OK.

I cannot connect from Filezilla on my local system nor from FTPTest.net

AWS Security Policy (Inbound). Outbound is open for all IPs, all ports.

SSH  TCP  22  10.100.0.0/18
SSH  TCP  22  10.0.0.0/16
Custom TCP Rule  TCP  21  0.0.0.0/0
Custom TCP Rule  TCP  18901  0.0.0.0/0
Custom TCP Rule  TCP  30000 - 31000  0.0.0.0/0
  • When you connect using filezilla or, preferably another command line based ftp client from a remote system, what error message are you getting ? Are you using any server based firewall, likes of iptables ? – MelBurslan Aug 8 '16 at 19:19
  • Here is the message from FTP Test. Warning: Selected port (18901) is not the default port (21) of the selected protocol. Status: Resolving address of Status: Connecting to Error: Could not connect to server: Connection refused Status: Connecting to Error: Could not connect to server: Connection refused – Matt Aug 8 '16 at 19:28
  • Yes, IPTables entries are above – Matt Aug 8 '16 at 19:28
  • You're using AWS, have you set your security policy to allow ftp access? – Eric Renouf Aug 8 '16 at 19:31
  • I have included my security policy above – Matt Aug 8 '16 at 19:42
2

I figured this out.

I needed to add

pasv_address=<Public IP> 

to my conf.

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.