Create user Xiao to allow only uploading and downloading files under the user's home directory (/var/www/html), not allowing Putty login
(For security reasons, do not give too much permission)
1. Create Xiao Users
[Email protected] root]# cd/var/www/html
[Email protected] html]# useradd xiao-d/var/www/html-s/sbin/nologin-g Apache
The-D directory specifies the home directory, and if this directory does not exist, the-m option can be used to create the master directory.
The-G user group specifies the user group to which the user belongs.
-S Shell file specifies the user's login shell.
[Email protected] html]# passwd Xiao
Enter the password two times to set the Xiao User's password, as
2, the owner of the/var/www/html directory and the group are changed to Apache, plus read and write permissions
[Email protected] html]# l-d.
Drwxr-xr-x 3 root root 4096 2015-06-16 06:37. (Original root)
[Email protected] html]# chown-r apache:apache.
[Email protected] html]# l-d.
Drwxr-xr-x 3 Apache Apache 4096 2015-06-16 06:37 (successfully changed to Apache)
[Email protected] html]# chmod-r 775. (Give permission to read and write)
-R the same changes to all files in the current directory as subdirectories
If this does not give permission, then uploading Dd.txt will prompt the following error
3. Testing
① See putty can login?
(No, Putty automatically disappears after entering the password)
Upload and download files under ②windows (or Linux)
It's the same with Linux.
11, only allow to upload and download files in the main directory, not allowed to log in with putty