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