Examples of Linux folder permissions for users

Source: Internet
Author: User

Problem:

I have a keesail user. I want to have it read and write the local folder permissions should be switched to the root account what commands to give Keesail permissions?

For example, a directory dir, your username Hengyang, you can give users permission to create a directory by executing the following command.
Execute with Root User:

Chown Hengyang.hengyang dir

Answer:

chown-r Keesail:keesail./local

Give Keesail permissions to the local directory

chmod 760./local

Give the local directory read and write permissions to Keesail, the other user does not have any permissions on this directory.


Add:

1. View directory and current file

The code is as follows Copy Code

[Root@localhost yuechaotian]# pwd
/home/yuechaotian
[Root@localhost yuechaotian]# LL
Total Dosage 8
Drwxr-xr-x 3 root 4096 December 7 14:52 study
Drwxr-xr-x 2 root 4096 December 9 21:43 test
[Root@localhost yuechaotian]# ll Test
Total Dosage 12
-rwxr-xr-x 1 root 11742 December 9 21:43 conf.rd

2. Users and groups that changed only the directory test did not change the file users and groups under the directory test

The code is as follows Copy Code

[root@localhost yuechaotian]# chown YUECHAOTIAN:DBA test
[Root@localhost yuechaotian]# LL
Total Dosage 8
Drwxr-xr-x 3 root 4096 December 7 14:52 study
Drwxr-xr-x 2 Yuechaotian dba 4096 December 9 21:43 test
[Root@localhost yuechaotian]# ll Test
Total Dosage 12
-rwxr-xr-x 1 root 11742 December 9 21:43 conf.rd

3. Use parameter-r to change directory test and its file users and groups

  code is as follows copy code

[root@localhost yuechaotian]# chown \ root:root Test
[root@localhost yuechaotian]# ll
Total usage 8
drwxr-xr-x  3 root root 4096 December   7 14:52 study
drwxr-xr-x  2 root root 4096 December   9 21:43 test
[root@localhost yuechaotian]# chown-r yuechaotian:dba test
[root@localhost Yuechaotia n]# ll
Total dosage 8
drwxr-xr-x  3 root        root 4096 December   7 14:52 study drwxr-xr-x  2 Yuechaotian dba  4096 December   9 21:43 test
[root@localhost yuechaotian]# ll test
Total dosage
-rwxr-xr-x  1 Yuechaotian dba 11742 December   9 21:43 conf.rd

The

Use-r parameter in chmod achieves the same effect: All files/folders within the folder are changed to the specified permissions.

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.