How to quickly add FTP/SFTP support in Linux
June 30, 2020
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!
Installation
Our first step is to install vsftpd. We can do this by running:
sudo apt-get upgradesudo apt-get install vsftpdNow after we install it, we need to start it. To do this, run:
sudo systemctl start vsftpdsudo systemctl enable vsftpdAnd that’s the basic setup! You now should have an FTP server up and running!
Configuration
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.originalAnd configuring the file is just a matter of opening up the configuration file!
Remember that the location of the configuration file is at /etc/vsftpd.conf
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=YESTo deny some users to login, add the following options in the end of the file:
userlist_deny=YESuserlist_file=/etc/vsftpd.denied_usersTo allow just some users to login:
userlist_deny=NOuserlist_enable=YESuserlist_file=/etc/vsftpd.allowed_usersTo 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=990Here 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=20Apply 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 restartAnd that is pretty much it for this tutorial! You now successfully have enabled FTP/SFTP on Linux! I hope this tutorial helped you!