Home > Hosting > Server

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

2023-02-05 11:39:37

This article introduces the knowledge about how to add/delete FTP users and set permissions in Linux. During the operation of actual cases, many people will encounter such difficulties. Next, let the editor guide you to learn Let's see how to deal with these situations! I hope you read it carefully and learn something!

1. Environment: ftp is vsftp. The user name is set to test. The restricted path is /home/test
2. Create a new user: under the root user:

  1. useradd -d /home/test test #Add user test, and set the home directory of test user as /home/test

  2. passwd test #Set password for test user

3. Change the corresponding permission settings of the user:

1. usermod -s /sbin/nologin test #Limited user test cannot telnet, only ftp 2. usermod -s /bin/bash test #User test returns to normal 3. usermod -d /home/test test #Change the home directory of user test to /test

4. Restrict users to only access /home/test, not to Other paths

Modify /etc/vsftpd/vsftpd.conf as follows:

1. chroot_list_enable=YES #Restrict access to its own directory 2. 3. # (default follows) 4. 5. chroot_list_file=/etc/vsftpd/vsftpd.chroot_list

Edit vsftpd.chroot_list file, add restricted users, one line for each user name

After modifying 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 users to change their passwords, but they do not have permission to log in to the system via telnet:

1. usermod -s /usr/bin/passwd test #Users will directly enter the encryption interface after telnet

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

1. #Under the root user: 2. userdel -r newuser 3. #Under ordinary users: 4. sudo userdel -r newuser

Because the user needs to be completely deleted, so add the -r option, and delete the user’s home directory and Mail directory deletion.

The content of how to add/delete FTP users and set permissions in Linux is introduced here, thank you for reading. If you want to know more industry-related knowledge, you can pay attention to the Yisuyun website, and the editor will output more high-quality practical articles for you!


Copyright Description:No reproduction without permission。

Knowledge sharing community for developers。

Let more developers benefit from it。

Help developers share knowledge through the Internet。

Follow us