Ftp – AWS:EC2:: Could not connect FTP client

amazon ec2ftp

My Server OS: Amazon Linux

I am trying to set up ftp. I have:

  • Installed vsftpd

  • open port 20-21

  • open port 1024 – 1048

Basically, I followed every of these steps

  • Start vsftpd service (the status indicate [ok])

I use filezilla for my ftp client.

Here is my setting/configuration:

Host: ec2-XX-XX-XXX-XX.compute-1.amazonaws.com

Port: -(blank, but I have tried 20 and 21 though)

Server Type: FTP – File Transder Protocol

Logon Type: Normal

Username: (tried root and ec2-user)

Transfer mode: Tried passive and active

I always has this error:

Status: Waiting to retry...
Status: Resolving address of ec2-XX-XX-XXX-XX.compute-1.amazonaws.com
Status: Connecting to XX.XX.XXX.XX:21...
Error:  Connection timed out
Error:  Could not connect to server

Have I missed any configuration/settings?

EDIT

After execute the /sbin/iptables -L -n

Here is the result:

Chain INPUT (policy ACCEPT)
target     prot opt source               destination         

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         

Best Answer

You have to enable passive mode in vsftpd, and make it listen to the elastic IP of your instance:

  • pasv_enable=YES
  • pasv_min_port=1024
  • pasv_max_port=1048
  • port_enable=YES
  • pasv_address=Elastic IP

Also, open up ports 1024-1048 in the server's security group, and on your linux server. Dont forget port 21 as well ;)