How to Install and Configure vsftpd on Ubuntu

What is Vsftpd ?

Warning: FTP is inherently insecure. If you must use FTP, consider securing your FTP connection with SSL/TLS. Otherwise, it is best to use SFTP, a secure alternative to FTP. In This blog you ‘ll learn how we can install and configure vsftpd server on ubuntu.   

ftp

The first two letters of vsftpd stand for “very secure” and the program was built to have strongest protection against possible FTP vulnerabilities.

Below you can find the steps that how to install and configure vsftpd in Ubuntu.

Steps to Install and configure vsftpd

Step 1. Install Vsftpd

Run the following commands to install vsftpd and any required packages with root privileged.

root@linuxtweaks:~# apt-get update
root@linuxtweaks:~# apt-get -y install vsftpd

Step 2. Configure Vsftpd

Edit the vsftpd configuration file with you favourite editor.

vi /etc/vsftpd.conf

Disallow anonymous, unidentified users to access files via FTP; change the anonymous_enable setting to NO

anonymous_enable=NO

Allow local uses to login by changing the local_enable setting to YES

local_enable=YES

If you want local user to be able to write to a directory, then change the write_enable setting to YES

write_enable=YES

Local users will be ‘chroot jailed’ and they will be denied access to any other part of the server; change the chroot_local_user setting to YES

chroot_local_user=YES

Save and Exit that file.

Step 3. Configure the User’s Home Directory

Because of a recent vsftpd upgrade, vsftpd is “refusing to run with writable root inside chroot”. A handy way to address this issue to is to take the following steps

  • Create a new directory within the user’s home directory
  • Change the ownership of that file to root
  • Make all necessary changes within the “files” subdirectory
mkdir /home/username/files
chown root:root /home/username

Then, as always, restart Vsftpd service to take affects

service vsftpd restart

Step 4. Ch-Root vsftpd users

  • if your Vsftpd version if 3.x add the following line in your vsftpd configuration file to Keep non-chroot listed users jailed and then restart vsftpd service.
root@linuxtweaks:~# echo "allow_writeable_chroot=YES" >> /etc/vsftpd.conf
root@linuxtweaks:~# service vsftpd restart
  •  if your have an extended vsftpd version (vsftpd-ext) then add the following line and restart vsftpd service
root@linuxtweaks:~# echo "allow_writable_chroot=YES" >> /etc/vsftpd.conf
root@linuxtweaks:~# service vsftpd-ext restart

Check you vsftpd Version by running following command.

root@linuxtweaks:~# vsftpd -v
vsftpd: version 3.0.2

Step 3. Access the FTP server

Once you have installed the FTP server and configured it to your liking, you can now access it.

You can reach an FTP server in the browser by typing the domain name into the address bar and logging in with the appropriate ID. Keep in mind, you will only be able to access the user’s home directory. ftp://linuxtweaks.in/

Alternatively, you can reach the FTP server through the command line by typing:

ftp linuxtweaks.in

Then you can use the word, “exit,” & ctrl+d to get out of the FTP shell.

View more posts in this category !!!

Install & Configure Vsftpd in Centos

Balvinder Singh

Hello, I am Balvinder Singh - DevOps Engineer with 2.5+ year of working experience with different server environments. Tag Line:-Linux | AWS| WHM |Monitoring | Virtualization | Optimization | Performance | Security | Release & Deployment. I love helping companies / clients to deploy their code / applicateions to well managed, optimized, secure server and can go extra mile to satisfy.

You may also like...

Leave a Reply

Your email address will not be published.