Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Can anyone offer any suggestions. I have an Amazon EC2 instance running, based on the 64-bit Amazon Linux AMI. I've installed all updates using yum, and have installed PHP5.3 and the vsFTPd service.

I've created a new user group, and a new user, given a password to the user and made the html folder for web php files owned by the new group. Everything in that respect works fine. Create a php file in vi and the page is visible in a browser.

Now i've started the vsFTPd server, all is ok. I can connect to it almost instantaneously from a terminal screen, but doing ls -l takes ages to return.

Connect from FTP software and it can take upwards of 60 seconds to connect, the same when changing folders. Then when you try and upload a file, sometimes it will go, and it always seems to create folders ok, but then times-out or drops the connection and won't restart. Cancel the transfer, and set it up again, and it reconnects fine.

Can anyone offer any ideas as to whats wrong? I've tried both passive mode on and off on the FTP client, but it doesn't make any difference. I don't see that much can be wrong as its connecting and does transfer a couple of small text files before timing out.

Any thoughts or suggestions would be very helpful if you guys can! I'm out of ideas!

share|improve this question
2  
Did you specify the pasv_min_port/pasv_max_port values and open the corresponding port range (as well as ports 20 and 21) in your security group? The approach I took to setting vsftpd up on Amazon's Linux is described here –  cyberx86 Oct 29 '11 at 0:00
    
@cyberx86 - thanks for that i'll give that a try. What min/max port numbers would you specify? I've got Port 21 set in the security settings for FTP, so i'll set 20 as well! –  TIW Oct 30 '11 at 17:08
    
Something above 10000 - pick something a bit random. You will need more ports for more users, so if you are the only user, you should be able to only keep 2 or 3 ports open (e.g. min: 15243, max: 15245) - I believe it is normally one port per connection (but it is often possible for the user to establish more than one simultaneous connection, even if unlikely). –  cyberx86 Oct 30 '11 at 19:18
    
@cyberx86 - Thanks very much. Yes that solved the problem, files are transferring very quickly and the whole FTP service is responding like lightening now!! Thanks for your help. –  TIW Oct 31 '11 at 14:18
add comment

1 Answer

One factor that may contribute to the poor functioning of vsFTPd is your firewall rule set. For a typical FTP session, you will want to use passive FTP (usually works better with your user's setups - both the programs they use and their firewalls).

For this, you will need to open ports 20, 21, and whatever ports you specify in your vsftpd configuration.

In vsftpd, you can configure a passive port range, by setting the pasv_min_port and pasv_max_port values. This allows you to use passive FTP while allowing them to easily work with firewalls of the sort implemented by EC2.

You should pick ports above 10000 - ideally something a bit random. You will need more ports for more users, so if you are the only user, you should be able to only keep 2 or 3 ports open (e.g. min: 15243, max: 15245) - I believe it is normally one port per connection (but it is often possible for the user to establish more than one simultaneous connection, even if unlikely)

If you have a firewall (e.g. shorewall) running on your server, you will need to configure that - also, your iptables rules need to permit the FTP connection on the ports you have specified. On the EC2 end of things, you need to open the appropriate ports in the security group your instance is running under. A few more points from my approach to setting up passive FTP with vsftpd on Amazon's Linux can be found here.

share|improve this answer
add comment

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.