This guide provides a step-by-step approach to configuring permissions for vsftpd (Very Secure FTP Daemon) on Debian, covering user management, directory permissions, and security hardening.
First, update your package list and install vsftpd:
sudo apt update && sudo apt install vsftpd
Edit the main configuration file (/etc/vsftpd.conf
) to set core permissions:
sudo nano /etc/vsftpd.conf
Key settings to enable (modify as needed):
local_enable=YES
write_enable=YES
chroot_local_user=YES
allow_writeable_chroot=YES
tcp_wrappers=YES
Disable anonymous access for security:
anonymous_enable=NO
Save changes and exit the editor.
Create a dedicated FTP user (e.g., ftpuser
) and set a strong password:
sudo adduser ftpuser
Optionally, modify the user’s home directory (if not using the default /home/ftpuser
):
sudo usermod -d /path/to/custom/directory ftpuser
Prevent shell login for the FTP user (enhances security):
sudo usermod -s /sbin/nologin ftpuser
Ensure the FTP user’s home directory has correct ownership and permissions:
sudo chown ftpuser:ftpuser /home/ftpuser # Set owner/group to the FTP user
sudo chmod 755 /home/ftpuser # Allow read/execute for others (required for FTP access)
For subdirectories where users need to upload files, retain 755
permissions (or use 775
for group write access if collaborating):
sudo chmod -R 755 /home/ftpuser/subdir # Replace with your subdirectory path
/etc/vsftpd.user_list
(one per line):echo "ftpuser" | sudo tee -a /etc/vsftpd.user_list
vsftpd.conf
:userlist_enable=YES
userlist_file=/etc/vsftpd.user_list
userlist_deny=NO # Only users in the list can log in
To deny specific users, set userlist_deny=YES
and add their usernames to /etc/vsftpd.user_list
.
Allow FTP traffic (port 21) and passive mode ports (default range: 40000–50000) using UFW:
sudo ufw allow 21/tcp
sudo ufw allow 40000:50000/tcp
sudo ufw reload
Apply all changes by restarting the service:
sudo systemctl restart vsftpd
Enable automatic startup on boot:
sudo systemctl enable vsftpd
Use an FTP client (e.g., FileZilla) to connect to your server:
Verify that you can:
/var/log/vsftpd.log
for errors.755
permissions.By following these steps, you’ll have a secure and functional vsftpd setup with proper permission controls for your Debian server.