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=NOlocal_enable=YESwrite_enable=YESchroot_local_user=YESThen, add the following lines to the bottom of the file:
user_sub_token=$USERlocal_root=/home/$USER/ftppasv_min_port=40000pasv_max_port=50000Save 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 ftpusersudo passwd ftpusersudo mkdir /home/ftpuser/ftpsudo chown nobody:nogroup /home/ftpuser/ftpsudo chmod a-w /home/ftpuser/ftpsudo mkdir /home/ftpuser/ftp/filessudo 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
Комментарии
Отправить комментарий