In this tutorial, we will show you how to install and configure vsftpd on your Ubuntu 14.04. For those of you who didn’t know, FTP stands for “file transfer protocol”, and it allows you to transfer files to a remote computer. The most common FTP server software for Ubuntu is the vsftpd package, which stands for “very secure FTP daemon.” It’s the default FTP package for Ubuntu, and most other Linux distributions as well.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple. I will show you the step-by-step installation vsftpd on Ubuntu 14.04.
Prerequisites
- A server running one of the following operating systems: Ubuntu 14.04, and any other Debian-based distribution like Linux Mint or elementary OS.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- SSH access to the server (or just open Terminal if you’re on a desktop).
- A
non-root sudo user
or access to theroot user
. We recommend acting as anon-root sudo user
, however, as you can harm your system if you’re not careful when acting as the root.
Install and Configure VSFTPD on Ubuntu 14.04
Step 1. Installing and Configure VSFTPD on Ubuntu 14.04
Now we install vsftpd (Very Secure FTP Deamon) package using the following command:
sudo apt-get install vsftpd
Step 2. Configure vsftpd.
Let’s edit the configuration file for vsftpd:
#nano /etc/vsftpd.conf listen=YES anonymous_enable=NO local_enable=YES write_enable=YES local_umask=022 nopriv_user=vsftpd virtual_use_local_privs=YES guest_enable=YES user_sub_token=$USER chroot_local_user=YES hide_ids=YES guest_username=vsftpd
Step 3. Creating and applying the SSL certificate.
Let’s go and create our encryption key or certificate to use to connect to the server. First, create a folder that will be used to store the keys.
mkdir /etc/ssl/certificates
Then run the commands below to create the encryption key that will last for 365 days.
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/certificates/vsftpd.pem -out /etc/ssl/certificates/vsftpd.pem
Once creating the key, go and change add and change these parameters in the default VSFTPD configuration file.
#nano /etc/vsftpd.conf rsa_cert_file=/etc/ssl/certificates/vsftpd.pem rsa_private_key_file=/etc/ssl/certificates/vsftpd.pem ssl_enable=YES allow_anon_ssl=NO force_local_data_ssl=YES force_local_logins_ssl=YES ssl_tlsv1=YES ssl_sslv2=YES ssl_sslv3=YES require_ssl_reuse=NO ssl_ciphers=HIGH
Step 4. Restart the vsftpd service.
service vsftpd restart
Step 5. Configuring user access.
With the vsftpd FTP server, you have the option to leave the FTP service authentication for only anonymous access or you can allow users, defined in /etc/passwd
or in the relevant access list, to log in.
Step 6. Configure the user’s home directory.
With a certain version of vsftpd you may receive the following error: 500 OOPS: vsftpd: refusing to run with writable root inside chroot(). Not to worry! Create a new directory for the user receiving the error (idroot in this case) that is a subdirectory of their home directory (/home/idroot
). For example:
Fix permissions for idroot home directory:
chmod a-w /home/idroot/
Make a new directory for uploading files:
mkdir /home/idroot/files chown idroot:idroot /home/idroot/files/
Congratulations! You have successfully installed vsftpd. Thanks for using this tutorial for installing vsftpd in Ubuntu 14.04 system. For additional help or useful information, we recommend you check the official vsftpd website.