Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to add FTP users and set permissions in Linux

Shulou Source: shulou.com Published: 2022-06-01 18:46:22 09月23日 Update

This article shows you how to add FTP users and set permissions in Linux. The content is concise and easy to understand. It will definitely make your eyes shine. I hope you can gain something through the detailed introduction of this article.

1. Environment: ftp is vsftp. The restricted user name is test. The restricted path is/home/test

2. Create user, command line state, under root user:

Run the command: "useradd -d /home/test test"//add the user test and specify the home directory of the test user as/home/test  

Run command: "passwd test"//Set password for test, enter same password twice after running  

3. Change the user's corresponding permission settings:

Run the command: "usermod -s /sbin/nologin test"//limit user test not telnet, only ftp  

Run command: "usermod -s /sbin/bash test"//user test returns to normal  

Run the command: "usermod -d /test test"//change the home directory of user test to/test  

4. Limit users to access only/home/test and not other paths

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

chroot_list_enable=YES

# (default follows)

chroot_list_file=/etc/vsftpd/vsftpd.chroot_list

Edit the content above

First line: chroot_list_enable=YES//restrict access to its own directory  

Line 3: Edit vsftpd.chroot_list. Find the chroot_list file according to the directory specified in the third line. (File names may vary slightly depending on host)

Edit vsftpd.chroot_list to add restricted users, one line per username

5. Restart the server

After changing the configuration file, don't forget to restart the vsFTPd server.

Run the command: /etc/init.d/vsftpd restart

6. Cloud Reminder If you need to allow users to modify passwords, but do not have telnet login system permissions:

Run the command: "usermod -s /usr/bin/passwd test"//user telnet will directly enter the encryption interface  

The above content is how to add FTP users and set permissions in Linux. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserves, please pay attention to the industry information channel.

Tags: Users commands runs restrictions permissions directories contents passwords files different one line skills server knowledge path three lines service same concise concise Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft NVidia Apple Shulou Information Docker