This tutorial will guide you through setting up an FTP server on Ubuntu 14.04 or 16.04 using vsftpd, one of the most popular FTP services. Once the FTP server is created, you'll be able to create new users for logging into your server via FTP.
Preliminary Requirements
- A VPS with Ubuntu 14.04 or 16.04 installed.
Steps to Set Up the FTP Server
1. Log in and Update the Server
First, log in to your server using SSH and update the package list:
sudo apt-get update
2. Install vsftpd
Install the vsftpd service:
sudo apt-get install vsftpd
3. Configure vsftpd
Next, you need to change the necessary settings in the vsftpd configuration file. Open the file with a text editor:
sudo vi /etc/vsftpd.conf
Find and modify the following lines to match these settings:
listen=YES
local_enable=YES
write_enable=YES
chroot_local_user=YES
Save and close the file (in vi, press Esc
, then type :wq
and press Enter
).
4. Restart the vsftpd Service
Restart the vsftpd service to apply the changes:
sudo service vsftpd restart
5. Add a New FTP User
Create a new FTP user:
sudo adduser youruser
You will be prompted to enter a password for the new user and provide additional information. You can leave the additional information fields blank by pressing Enter
.
6. Provide Access Permissions
To ensure security while allowing access, create a subdirectory in the user's home directory with write access. This prevents the user from accessing the root directory.
sudo chown root:root /home/youruser
sudo mkdir /home/youruser/yourfiles
sudo chown youruser:youruser /home/youruser/yourfiles
7. Log In to FTP
Restart the vsftpd service once more:
sudo service vsftpd restart
Now, you can connect to your FTP server using an FTP client like FileZilla with the new user credentials. The new user will be able to upload files to the newly created folder but will not have access to the root directory.
By following these steps, you should have a secure and functional FTP server running on your Ubuntu 14.04 or 16.04 VPS.