- Install VsFTPd server on ubuntu
Open the terminal and run the following command
sudo apt-get install vsftpd
- Configuring Vsftpd server
The default configuration file is located at /etc/vsftpd.conf so you need to edit this file to configure your vsftpd server
sudo vi /etc/vsftpd.conf
Disable the ability for users to log in anonymously by changing the following option
Next, we need to enable user logins that use the local authentication files, since we disabled anonymous access. Uncomment the following line
To enable users to make modifications to the filesystem, we will uncomment the following option
uncomment the chroot_local_user option to restrict users to their own home directories
Save and close the file.
- Creating FTP User
Because of the way vsftpd secures its chroot jails, the chroot must not be owned by the user and must not be writeable. Because of this, it is best to implement a user specifically for use with FTP.
Create the user using the following command
sudo adduser ftpuser1
Assign a password and feel free to press “ENTER” through the other prompts. Now, give root ownership of the ftpuser1’s home directory:
sudo chown root:root /home/ftpuser1
We need to create a separate directory within this home directory where files can be uploaded. Then, we need to give this directory over to our FTP user:
sudo mkdir /home/ftpuser1/files
sudo chown ftpuser1:ftpuser1 /home/ftpuser1/files
- Restart the FTP server:
sudo service vsftpd restart
Now, we should be able to log in (insecurely) as the ftpuser1 and upload files to the files directory.