11, only allow to upload and download files in the main directory, not allowed to log in with putty

Source: Internet
Author: User

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

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.