How to Create a FTP User and Restrict Them to a Specific Directory in Ubuntu 16.04

0
153

If you ever wondered how to create an FTP user and then restrict them to a certain directory in Ubuntu 16.04, this guide is for you. This guide works especially well with the following: Ubuntu 16.04, Amazon Web Services (AWS) – EC2.

You want to open up Terminal and type the following commands and follow the instructions in order.

 

You first want to make sure your ports are open in your security group for your server in AWS – EC2.

If not, you will need to add two Custom TCP rules:

Custom TCP Rule: 20-21

Custom TCP Rule: 1024-1048

Then save the rules.

 

We will then create FTP users.

We first want to create an FTP user:

 

If you want, you can change the home directory of the user:

 

You can also change the home directory by editing a file:

Then find and change it to whatever you like (something like this):

 

You first want to login as root:

 

You then want to update the repositories.

 

After that, you want to install vsftpd:

 

Create a backup of your vsftpd file:

You can then edit the vsftpd.conf file with nano or vi:

or

 

Then you want to edit or uncomment the following lines:

and you want to add the following lines:

 

You then want to restart vsftpd for the changes to take effect:

or

 

You can now try to log into your server using FTP (port 21) via your favorite FTP client, such as FileZilla.

Good luck, and happy coding and working with servers!

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.