Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

i installed vsftpd and everything is working fine when accessing it locally, but i cannot view the folders when accessing it remotely.

using filezilla in my remote PC, i get this:

status: connecting to 192.x.x.x
status: connection established, waiting for welcome message
response: welcome 
command: user admin
response: specify pass
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 "/var/ftp"
command: type I
response: 200 switching to binary mode
command: PASV
response: 227 entering passive mode (192.168.8.5,59,0).
command: list

and it stops right there, then connection timeout, i cannot view the folders or the directories on the ftp server.

On my iptables -L -n

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 dpt:20

My /etc/vsftp/vsftp.conf

anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
#anon_upload_enable=YES
#anon_mkdir_write_enable=YES
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
#chown_uploads=YES
#chown_username=whoever
#xferlog_file=/var/log/xferlog
xferlog_std_format=YES
idle_session_timeout=120
#data_connection_timeout=120
#nopriv_user=ftpsecure
#async_abor_enable=YES
#ascii_upload_enable=YES
#ascii_download_enable=YES
ftpd_banner= Welcome 
#deny_email_enable=YES
#chroot_local_user=YES
#chroot_list_enable=YES
#chroot_list_file=/etc/vsftpd/chroot_list
#ls_recurse_enable=YES
listen=YES
pam_service_name=vsftpd
userlist_enable=YES
tcp_wrappers=YES 
share|improve this question
    
If you don't get an answer here, try serverfault. –  Robert Kerr May 6 '13 at 11:24
    
will do. thanks :) –  user1933824 May 6 '13 at 11:26

1 Answer 1

I just encountered this myself last week. You are firewalling the ports it needs to use for passive mode.

In your config file you must set pasv_min_port and pasv_max_port, then open that port range in iptables.

from the vsftp configuration options

pasv_max_port — Specifies the highest possible port sent to the FTP clients for passive mode connections. This setting is used to limit the port range so that firewall rules are easier to create.

The default value is 0, which does not limit the highest passive port range. The value must not exceed 65535.

pasv_min_port — Specifies the lowest possible port sent to the FTP clients for passive mode connections. This setting is used to limit the port range so that firewall rules are easier to create.

The default value is 0, which does not limit the lowest passive port range. The value must not be lower 1024.

You will need at least one port per concurrent passive connection, so make the range wide enough to handle the number of concurrent connections you expect.

share|improve this answer
    
i managed to make this work by removing port 20 in the iptables, but i wasnt sure how that port had an effects on why i wasnt able to view the listing using port 21 in ftp client. –  user1933824 May 7 '13 at 8:10
    
It is likely using an active connection instead of passive. That is why it is working –  Scott Chamberlain May 7 '13 at 12:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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