In this tutorial, we are going to install vsftpd and set it up for a user’s directory on Ubuntu 22.04
VSFTPD is a shortcut of a very secure FTP daemon and is an FTP server for Unix systems, including Linux. Vsftpd is the default FTP server in the Ubuntu, CentOS, and RHEL distributions. System administrators, daily, are adding new users to the systems and configuring the vsftpd to allow the user to upload files or folders only in their directories on the server. This scenario is mostly for resellers who want their users to have limited access.
Installing and configuring the vsftpd for a user’s directory on Ubuntu 22.04 is a straightforward process. Let’s get started!
Table of Contents
Prerequisites
- Fresh install of Ubuntu 22.04
- User privileges: root or non-root user with sudo privileges
Step 1. Update the System
Update the system packages to the latest versions available.
Step 2. Install vsftpd daemon
Before we start with the configuration, we will install the VSFTPD daemon with the following commands:
Once installed, start and enable the vsftpd. service.
Check if the service is running properly.
You should get the following output:
Step 3. Create User
The next step is to create a user. To do that, execute the following command:
Execute the command, enter the password twice, hit Enter five times, and confirm the information with Y.
The user developer is automatically created in the /home/developer directory.
Now, we will create a directory called ftp inside the home directory of the developer user.
Once created, set the following permissions to the ftp folder.
Step 4. Configure FTP Access
Now, when the user is created, we can proceed to configure the FTP access.
The configuration of the VSFTPD is stored in the /etc/vsftpd.conf file. Before we make any changes, it is recommended to have a copy of the file.
Once these changes are made, save the file and restart the vsftpd service.
Next is to add the developer user in the /etc/vsftpd.userlist
Step 5. Test the FTP access
Before testing the connection, we need to open some ports via the UFW service.
Once done, check the ufw status with the same command ufw status.
Now, execute the following command to log in with the developer user and password:
Enter the developer user and password. Once logged in, you will receive the following output:
If you try to log in with some other user that does not belong to the vsftpd user’s list, you will get the following output:
As you can see, permission is denied for other users. This tells us that we successfully configured the vsftpd for a user’s directory on Ubuntu 22.04
Of course, you do not have to configure this by yourself. All you need to do is sign up for one of our NVMe VPS plans and submit a support ticket. Our admins will help you with any aspect of vsftpd configuration.
If you liked this about configuring vsftpd for a users’ directory on Ubuntu 22.04, please share it with your friends on the social networks or simply leave a reply below.
doesn’t work at all.
ftp> mkdir testfolder
550 Create directory operation failed.
Make sure you set the correct permission and ownership to the directory set in local_root.
in your command
chown nobody:nogroup /home/developer/ftp/
should be
chown developer: /home/developer/ftp/
otherwise the directory ftp wouldn’t even be visible
and, why not using just:
sudo chmod 700 /home/developer/ftp
since with a-w we are not allowing to write in the ftp folder which is what we usually need when accessing to our own folder
btw, thanks for the tutorial. all the steps worked except those two
allow_writeable_chroot=YES
typing this will go to the confog file
but how could it not be rooted and still work
In our tutorial are the following lines, tested and working:
chroot_local_user=YES
write_enable=YES