Setting up FTP Server on Ubuntu – Amazon EC2

File Transfer Protocol (FTP) is a TCP protocol for uploading and downloading files between computers.

Amazon EC2 instance comes without FTP server installed. So you have to install it manually.

Amazon EC2: Unblock FTP port

FTP works on port 21 by default. By default this port is blocked by the AWS firewall. You must unblock this port (21) by changing the instance permissions prior to setting up FTP so that you can access FTP remotely. This can be done using the AWS Management Console.

Go to Security Groups, select the group associated with your instance.

Add TCP rule with port 21.


Install and Configure FTP server – vsftpd

vsftpd is an FTP daemon available in Ubuntu. It is easy to install and set up it. To install vsftpd run the following command:

sudo apt-get install vsftpd


Edit vsftp configuration file (usually located at /etc/vsftpd.conf).


Disable anonymous access:


Enable local access:

By default, local system users are not allowed to login to FTP server. To change this setting, you should uncomment the following line:


Enable writing:

By default, users are allowed to download files from FTP server. They are not allowed to upload files to FTP server. To change this setting, you should uncomment the following line:



Chown user:


chown_username=your user name (! not root)


After you finish configuring FTP server you need to restart it:

sudo service vsftpd restart





  • Claudesutterlin

    Old article but one of the top search results so, here’s a tip.

    If you’re using FileZilla to connect and getting “Failed to retrieve directory listing” change your Transer Mode to Active in the connection properties.

  • and how do you setup individual FTP user accounts?

    • Alex Laughnan

      Did you solve this Rizky?

      • nope. not yet. let me know if you find anything useful.

        • Ryan Coleman

          Wouldn’t you set up a new local user? Or is there something else that’s blocking it out?

          I’m trying to do this right now with proftpd.

          • Ryan Coleman

            Yeah, that worked for me… set up the user, open the port forward (I’m using 8021) and restart the service.

            I am having the same issue with directory listings.

          • didn’t think of that. i thought the system and ftp user was two different thing.

            okay then. will do that. thx!

  • Wawa

    Why don’t you use SFTP with the .pem file?