First, create a new user, and set the directory, prohibit Shell login
Useradd-m-d/home/wwwroot/licnlt-s/usr/sbin/nologin LICNLT
Nologin to confirm the location in advance, usually under/usr/sbin or/sbin (you can view the Nologin configuration of sshd in/etc/passwd)
Second, set the user password
passwd LICNLT
Third, set the user directory owner to root
Chown root:root/home/wwwroot/licnlt/ #目录只能由root所有chmod 755/home/wwwroot/licnlt #目录不可以有群组写入权限
Iv. Modification of/etc/ssh/sshd_config files
#注释掉这行 #subsystem sftp /usr/libexec/openssh/sftp-server# add Subsystem sftp internal-sftp # At the end of the configuration file Specifies that the Internal-sftpmatch user LICNLT #匹配用户 with the system comes with the SFTP service , and if multiple groups are to be matched, separate the groups with commas CHROOTDIRECTORY/HOME/WWWROOT/LICNLT / #用chroot将指定用户的根目录, meaning of chroot
V. Restart the SSH service
Service sshd Restart
Six, the user login after entering the/HOME/WWWROOT/LICNLT is the user root directory, the root directory is unable to write, so first use root under/home/wwwroot/licnlt/new www directory, and set permissions 777
Mkdir/home/wwwroot/licnlt/www
Modify Directory Owners and permissions
Chown Licnlt:licnlt/home/wwwroot/licnlt/wwwchmod 777/home/wwwroot/licnlt/www
Setting SFTP user access directory permissions under Linux