CentOS Add FTP user and prohibit directory

Source: Internet
Author: User

1, Environment: FTP for VSFTP. The user named Ftpuser is restricted. The restricted path is/home/ftpuser

2, build the user, the command line state, under the root user:

Run command: "useradd-d/home/ftpuser Ftpuser"//Add user Ftpuser and make Ftpuser user's home directory as/home/ftpuser

Run the command: "passwd ftpuser"//Set the password for Ftpuser, enter the same password two times after running

3, change the user's corresponding permission settings:

Run command: "usermod-s/sbin/nologin Ftpuser"//Limited User Ftpuser cannot telnet, FTP only

Run command: "usermod-s/sbin/bash ftpuser"//user Ftpuser back to normal

Run command: "usermod-d/ftpuser ftpuser"//change user Ftpuser's home directory to/ftpuser

4, restrict the user to access only/home/ftpuser, cannot access other paths

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

chroot_local_user=nochroot_list_enable=yes# (default follows) Chroot_list_file=/etc/vsftpd/vsftpd.chroot_list

Edit the above content

First line:Chroot_local_user=no

Second line: Chroot_list_enable=yes//Restrict access to own directory

Line four: Edit Vsftpd.chroot_list. According to the third line of the specified directory, locate the Chroot_list file. (The file name may differ slightly depending on the host)

Edit Vsftpd.chroot_list, add restricted users, one row per user name

Description: Chroot_local_user=no All users are not limited to the main directory, chroot_list_enable=yes means to enable chroot_list_file, because Chroot_local_user=no, That is, all users are "not confined to the home directory", so the chroot_list_file that are always used as "exception lists" are those who "will be restricted to the home directory".

5. Restart the server

Do not forget to restart the VSFTPD server after changing the configuration file

Run Command: Service vsftpd restart

6, if you need to allow users to change the password, but do not have Telnet login system permissions:

Run command: "usermod-s/usr/bin/passwd ftpuser"//user Telnet will go directly to the change interface

CentOS Add FTP user and prohibit directory

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.