In this guide, we will explore how to configure the Very Secure FTP Daemon (VSFTPD) for multiple users with specific directories. This is particularly useful when you want to provide FTP access to different users, each with their unique directory.
To setup VSFTPD for multiple users with specific directories, you need to modify the VSFTPD configuration file to include a user-specific configuration directory. Then, create user-specific configuration files in that directory for each user, where you can define settings like file permissions and directory redirection. Finally, restart the FTP server for the changes to take effect.
What is VSFTPD?
VSFTPD is a GPL licensed FTP server for UNIX systems, including Linux. It is known for its security features and speed. VSFTPD supports both anonymous and authenticated FTP access and can be configured for various use cases.
Before we start, make sure you have:
- A Linux server with VSFTPD installed.
- Root or sudo access to the server.
Step 1: Modify the VSFTPD Configuration File
The main configuration file for VSFTPD is located at
/etc/vsftpd.conf. Open this file using a text editor like vim:
sudo vim /etc/vsftpd.conf
Add the following line to the configuration file:
This line tells VSFTPD to look for user-specific configuration files in the directory
Step 2: Create the User Configuration Directory
Next, create the directory for user-specific configuration files:
sudo mkdir /etc/vsftpd/user_config_dir/
Step 3: Create User-Specific Configuration Files
For each user who needs FTP access, create a user-specific configuration file in the
user_config_dir directory. For example, if the user is
alice, create the file
sudo vim /etc/vsftpd/user_config_dir/alice
In this file, you can add the desired settings for the user
Step 4: Configure User-Specific Settings
In the user-specific configuration file, you can add various settings. For example, you can add
local_umask=0737 to enforce specific file permissions. The
local_umask parameter defines the permissions for newly created files. In this case,
0737 means that the owner has read and write permissions, while others have no permissions.
If you want to redirect users to specific folders outside their home directory, you can use the
local_root option. For example, to redirect user
/var/www/alice, add the line
alice‘s configuration file.
Step 5: Restart the FTP Server
Finally, restart the FTP server for the changes to take effect:
sudo service vsftpd restart
By following these steps, you can set up VSFTPD for multiple users, each with their specific directories. This setup provides flexibility and security by allowing each user to have their own configuration and directory.
Remember to thoroughly test your configuration to ensure everything works as expected. For more information and detailed configuration options, refer to the VSFTPD manual page and the VSFTPD example configuration files.
The default location for the VSFTPD configuration file is
You can install VSFTPD on a Linux server by using the package manager of your distribution. For example, on Ubuntu, you can use the command
sudo apt-get install vsftpd.
Yes, VSFTPD supports anonymous FTP access. You can enable it by setting the
anonymous_enable option to
YES in the VSFTPD configuration file.
To set a maximum upload size, you can use the
anon_max_rate option in the VSFTPD configuration file. For example, to limit the upload size to 1MB per second, you can set
To restrict FTP users to their home directories, you can set the
chroot_local_user option to
YES in the VSFTPD configuration file. This will prevent users from navigating outside their home directories.
Yes, VSFTPD supports SSL/TLS encryption. You can enable it by setting the
ssl_enable option to
YES in the VSFTPD configuration file and configuring the SSL/TLS certificates.
To limit the number of simultaneous connections, you can use the
max_per_ip options in the VSFTPD configuration file. These options define the maximum number of clients and connections per IP address, respectively.
VSFTPD provides logging capabilities by default. You can find the log file at
/var/log/vsftpd.log. You can also configure the logging level and customize the log format in the VSFTPD configuration file.
Yes, VSFTPD supports virtual users. You can configure virtual users by using external authentication mechanisms like PAM or a user database file. The configuration for virtual users is done in the VSFTPD configuration file.
If you encounter issues with VSFTPD, you can check the log file at
/var/log/vsftpd.log for any error messages. You can also enable debug mode by setting the
debug_level option to a higher value in the VSFTPD configuration file to get more detailed information during troubleshooting.