Home > Operation and Maintenance > Linux Operation and Maintenance > How to add/delete FTP users and set permissions in Linux

How to add/delete FTP users and set permissions in Linux

PHPz
Release: 2023-05-12 20:46:12
forward
3042 people have browsed it

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:

  1. useradd -d /home/test test #Add user test and formulate test The user's home directory is/home/test

  2. 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
Copy after login

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
Copy after login

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
Copy after login

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后将直接进入改密界面
Copy after login

6. If you want to delete the user, use the following code:

1. #在root用户下:
2. userdel -r newuser
3. #在普通用户下:
4. sudo userdel -r newuser
Copy after login

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!

Related labels:
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template