Home > Article > Operation and Maintenance > How to add/delete FTP users and set permissions in Linux
1. Environment: ftp is vsftp. The username is set to test. The restricted path is /home/test
2. Create a user: Under the root user:
useradd -d /home/test test #Add user test and formulate test The user's home directory is/home/test
passwd test #Set a password for the test user
3. Change the corresponding permission settings of the user:
1. usermod -s /sbin/nologin test #限定用户test不能telnet,只能ftp 2. usermod -s /bin/bash test #用户test恢复正常 3. usermod -d /home/test test #更改用户test的主目录为/test
4. Restrict users to only access /home/test and not other paths
Modify /etc/vsftpd/vsftpd.conf as follows:
1. chroot_list_enable=YES #限制访问自身目录 2. 3. # (default follows) 4. 5. chroot_list_file=/etc/vsftpd/vsftpd.chroot_list
Edit the vsftpd.chroot_list file and add restricted users, one line for each user name
After changing the configuration file, don’t forget to restart the vsftpd server
1. [root@localhost]# /etc/init.d/vsftpd restart
5. If you need to allow the user to change the password, but do not have the authority to log in to the system via telnet:
1. usermod -s /usr/bin/passwd test #用户telnet后将直接进入改密界面
6. If you want to delete the user, use the following code:
1. #在root用户下: 2. userdel -r newuser 3. #在普通用户下: 4. sudo userdel -r newuser
Because the user needs to be completely deleted, So add the -r option to delete the user's home directory and mail directory at the same time.
The above is the detailed content of How to add/delete FTP users and set permissions in Linux. For more information, please follow other related articles on the PHP Chinese website!