How to quickly add FTP/SFTP support in LinuxJune 30, 20202 min read
Enabling FTP in Linux is actually really simple and not that daunting. Here is a quick, simple tutorial on how to enable FTP in Linux!
Our first step is to install
vsftpd. We can do this by running:
sudo apt-get upgradesudo apt-get install vsftpd
Now after we install it, we need to start it. To do this, run:
sudo systemctl start vsftpdsudo systemctl enable vsftpd
And that's the basic setup! You now should have an FTP server up and running!
This part is optional really, since most of the configuration settings that are essential are already enabled but it's really important to know about configuring vsftpd.
First, before we configure vsftpd, lets make a backup of the original configuration file:
sudo cp /etc/vsftpd.conf /etc/vsftpd.conf.original
And configuring the file is just a matter of opening up the configuration file!
Remember that the location of the configuration file is at
Basic Setup of the Configuration File
To disable anonymous login and to enable local users login and give them write permissions:
# No anonymous loginanonymous_enable=NO# Let local users login# If you connect from the internet with local users, you should enable TLS/SSL/FTPSlocal_enable=YES# Write permissionswrite_enable=YES
To deny some users to login, add the following options in the end of the file:
To allow just some users to login:
To use vsftpd with encryption (it's safer), change or add the following options (some options aren't on the original config file, so add them):
ssl_enable=YESallow_anon_ssl=NOforce_local_data_ssl=YESforce_local_logins_ssl=YESssl_tlsv1=YESssl_sslv2=YESssl_sslv3=YES# Filezilla uses port 21 if you don't set any port# in Servertype "FTPES - FTP over explicit TLS/SSL"# Port 990 is the default used for FTPS protocol.# Uncomment it if you want/have to use port 990.#listen_port=990
Here are other additional options that may come handy:
# Show hidden files and the "." and ".." folders.# Useful to not write over hidden files:force_dot_files=YES# Hide the info about the owner (user and group) of the files.hide_ids=YES# Connection limit for each IP:max_per_ip=2# Maximum number of clients:max_clients=20
Apply Configuration Changes
If you have modified the configuration file, remember that we need to apply them! To do this, run:
sudo /etc/init.d/vsftpd restart
And that is pretty much it for this tutorial! You now successfully have enabled FTP/SFTP on Linux! I hope this tutorial helped you!