Ubuntu FTP Server User Management Guide
Managing users on an Ubuntu FTP server primarily involves using vsftpd (Very Secure FTP Daemon), the most common FTP server software. Below is a structured guide covering installation, user creation/deletion, permission management, and key configurations.
1. Install vsftpd
Before managing users, install vsftpd via the terminal:
sudo apt update
sudo apt install vsftpd
During installation, you’ll be prompted to start the service automatically—select Yes.
2. Configure vsftpd for User Management
Edit the vsftpd configuration file to enable core user-related features:
sudo nano /etc/vsftpd.conf
Set the following key options (uncomment or modify as needed):
local_enable=YES: Allow local system users to log in.write_enable=YES: Enable file uploads/downloads.chroot_local_user=YES: Restrict users to their home directories (security best practice).allow_writeable_chroot=YES: Permit writes in chroot directories (required ifchroot_local_user=YES).userlist_enable=YES: Use a user list to control access.userlist_file=/etc/vsftpd.user_list: Path to the user list file.userlist_deny=NO: Allow only users in the list to log in (set toYESto deny them).
3. Create FTP Users
Add a System User for FTP
Use the adduser command to create a new user (this also creates a home directory):
sudo adduser ftpuser
Follow prompts to set a password and optional details (e.g., full name).
Restrict Shell Access (Optional but Recommended)
To prevent the user from logging into the system via SSH, modify their shell to /sbin/nologin:
sudo usermod -s /sbin/nologin ftpuser
Set Home Directory Permissions
Ensure the user’s home directory is owned by them and has correct permissions:
sudo chown ftpuser:ftpuser /home/ftpuser
sudo chmod 755 /home/ftpuser
This allows the user to read/write files in their directory while restricting access to others.
4. Manage User Access via User List
The /etc/vsftpd.user_list file controls which users can log in. By default, it’s empty—add allowed users one per line:
sudo nano /etc/vsftpd.user_list
Enter usernames (e.g., ftpuser), save, and exit.
Restart vsftpd to Apply Changes
After modifying the user list or config file, restart the service:
sudo systemctl restart vsftpd
5. Delete FTP Users
Option 1: Delete the System User (Recommended)
Use the deluser command to remove the user and their home directory:
sudo deluser ftpuser --remove-home
This deletes the user account and all associated files.
Option 2: Remove from User List Only
If you want to retain the user but block FTP access, simply remove their username from /etc/vsftpd.user_list and restart vsftpd.
6. Configure User Permissions
Fine-tune user access with these common settings in /etc/vsftpd.conf:
Chroot Restrictions
chroot_local_user=YES: Locks users to their home directories (prevents accessing other parts of the server).chroot_list_enable=YES: Allows specific users to bypass chroot (useful for admins). Create/etc/vsftpd.chroot_listand add exempt users.
Write Permissions
write_enable=YES: Enables file modifications (uploads/deletes).local_umask=022: Sets default file permissions (e.g.,755for directories,644for files).
Anonymous Access (Disable for Security)
Ensure anonymous access is turned off:
anonymous_enable=NO
7. Test FTP Connectivity
Use an FTP client (e.g., FileZilla) or command line to verify user access:
ftp your_server_ip
Enter the FTP username and password. If configured correctly, you should be able to log in and access the user’s home directory.
By following these steps, you can effectively manage FTP users on Ubuntu, ensuring secure and controlled access to your server. Always remember to restart vsftpd after making configuration changes to apply them.
以上就是关于“Ubuntu FTP Server用户管理”的相关介绍,筋斗云是国内较早的云主机应用的服务商,拥有10余年行业经验,提供丰富的云服务器、租用服务器等相关产品服务。云服务器资源弹性伸缩,主机vCPU、内存性能强悍、超高I/O速度、故障秒级恢复;电子化备案,提交快速,专业团队7×24小时服务支持!
简单好用、高性价比云服务器租用链接:https://www.jindouyun.cn/product/cvm