How to Enable FTP on Ubuntu: A Step-by-Step Guide
Install vsftpd on Ubuntu, allow uploads, lock users into their home folder, open the passive ports, switch on TLS encryption and fix common errors.
3 min readBy Soumya
Reviewed by the AmazingRDP technical team

Need a server to host files on? A Linux VPS gives you root access and a public IP address. See Linux VPS from $6.99
FTP is the old, widely supported way to move files to and from a server. On Ubuntu the usual FTP server is vsftpd. This guide sets it up with encryption, because plain FTP sends passwords as readable text.
First, check whether you need FTP at all. Every Ubuntu server with SSH already has SFTP: encrypted file transfer on port 22, with nothing to install. In FileZilla or WinSCP, choose the protocol SFTP and sign in with your SSH user. See our WinSCP guide. Set up FTP only when a device or program insists on it.
1. Install vsftpd
sudo apt update
sudo apt install vsftpd
sudo cp /etc/vsftpd.conf /etc/vsftpd.conf.bak
The third line keeps a copy of the original settings file.
2. Configure it
sudo nano /etc/vsftpd.conf
Find these lines, remove the # in front where there is one, and set the values. Add the lines that are missing at the end of the file.
local_enable=YES
write_enable=YES
chroot_local_user=YES
allow_writeable_chroot=YES
pasv_min_port=40000
pasv_max_port=40100
| Setting | What it does |
|---|---|
local_enable | Users of the server may sign in |
write_enable | Uploads, renaming and deleting are allowed |
chroot_local_user | Each user is locked into their own home folder |
allow_writeable_chroot | Lets that locked folder be writable; without it, login fails with a "writable root" error |
pasv_min_port, pasv_max_port | The port range for file transfers and listings, so that the firewall can allow it |
If the server sits behind NAT, add pasv_address= with its public IP address.
3. Switch on encryption
In the same file, set:
ssl_enable=YES
force_local_logins_ssl=YES
force_local_data_ssl=YES
Ubuntu's file already points rsa_cert_file and rsa_private_key_file at a self-signed certificate that the system created, which is enough to encrypt the connection. Clients show a certificate warning on first use. If the server has a domain name, a free Let's Encrypt certificate removes the warning: put its fullchain.pem and privkey.pem paths into those two lines.
4. Create a user
sudo adduser ftpuser
Any existing user of the server can sign in as well. To allow only chosen users, add to the settings file:
userlist_enable=YES
userlist_file=/etc/vsftpd.userlist
userlist_deny=NO
and list the allowed names, one per line:
echo "ftpuser" | sudo tee -a /etc/vsftpd.userlist
5. Open the firewall
sudo ufw allow OpenSSH
sudo ufw allow 21/tcp
sudo ufw allow 40000:40100/tcp
sudo ufw status
The first line matters if the firewall is not on yet: enabling it without allowing SSH locks you out of the server. More in open or block a port in the Ubuntu firewall.
6. Restart and test
sudo systemctl restart vsftpd
sudo systemctl enable vsftpd
sudo systemctl status vsftpd
In FileZilla, open the Site Manager and enter the server's address, port 21, encryption Require explicit FTP over TLS, and the user name and password. Upload a file and download it again.
Errors and their causes
| Message | Cause |
|---|---|
| 500 OOPS: refusing to run with writable root inside chroot() | allow_writeable_chroot=YES is missing |
| 530 Login incorrect | Wrong password, the user is not in the user list, or the user's shell is not listed in /etc/shells |
| Login works, the file list times out | The passive ports are closed in a firewall, or pasv_address is missing behind NAT |
| The service does not start | A typing mistake in the settings file; sudo journalctl -u vsftpd names the line |
Keep it safe
- Do not switch on anonymous access (
anonymous_enablestays at NO) unless you mean to publish files to everyone. - Use long passwords; FTP ports are tried by bots all day.
- If only a few addresses need access, allow port 21 for those addresses only.
A Linux VPS comes with root access for a setup like this. For sharing files with Windows PCs inside a network, Samba is the better tool. Related: check open ports on Ubuntu.
Questions
How do I install an FTP server on Ubuntu?
Install vsftpd with sudo apt install vsftpd, edit /etc/vsftpd.conf, open the ports and restart the service.
Which ports does FTP need?
Port 21 for the connection, plus a passive port range that you set in vsftpd and allow in the firewall.
Is FTP secure?
Plain FTP is not: passwords travel as readable text. Use FTP over TLS as shown here, or SFTP.
What is the difference between FTP and SFTP?
SFTP runs over SSH on port 22, is encrypted, and needs no extra server software on Ubuntu. FTP is a separate, older protocol.