How To Set Up vsftpd for a User's Directory on Ubuntu 16.04

How To Set Up vsftpd for a User's Directory on Ubuntu 16.04

How To Set Up vsftpd for a User's Directory on Ubuntu 16.04

If you need to transfer files securely between computers or servers, you may want to consider setting up a FTP server on your Ubuntu 16.04 system using vsftpd. In this tutorial, we will walk you through the steps of installing and configuring vsftpd to allow file transfers to a specific user's directory.

Step 1: Install vsftpd

To get started, open a terminal window on your Ubuntu 16.04 system and run the following command to install vsftpd:

sudo apt-get install vsftpd

Step 2: Configure vsftpd

Next, we need to configure vsftpd to allow connections and file transfers. Open the vsftpd configuration file using the following command:

sudo nano /etc/vsftpd.conf

Uncomment the following lines by removing the "#" symbol:

anonymous_enable=NO
local_enable=YES
write_enable=YES
chroot_local_user=YES

Then, add the following lines to the bottom of the file:

user_sub_token=$USER
local_root=/home/$USER/ftp
pasv_min_port=40000
pasv_max_port=50000

Save and close the file.

Step 3: Create a User and Directory

Now, create a user account and a directory for the user's files. Run the following commands:

sudo useradd -m ftpuser
sudo passwd ftpuser
sudo mkdir /home/ftpuser/ftp
sudo chown nobody:nogroup /home/ftpuser/ftp
sudo chmod a-w /home/ftpuser/ftp
sudo mkdir /home/ftpuser/ftp/files
sudo chown ftpuser:ftpuser /home/ftpuser/ftp/files

The first command creates a new user named "ftpuser". The second command sets a password for the user. The next few commands create the user's directory and set the appropriate permissions.

Step 4: Restart vsftpd

Finally, restart vsftpd to apply the changes:

sudo service vsftpd restart

You should now be able to connect to the FTP server and transfer files to the user's directory using an FTP client.

Conclusion

In this tutorial, we have shown you how to set up vsftpd for a user's directory on Ubuntu

Комментарии

Популярные сообщения из этого блога

How To Modify CSS Classes in JavaScript

How To Backup MySQL Databases on an Ubuntu VPS

How To Backup PostgreSQL Databases on an Ubuntu VPS