Linux File system permissions

Source: Internet
Author: User




To understand the basic file system permissions:


Impact of permissions on files on the directory

R (Read) can read the contents of the file to list the contents of the directory (file name)

W (write) can change the contents of a file to create or delete any file in a directory

X (execute) can access the contents of the directory as a command execution file (depending on the permissions of the files in the directory)


Note: Usually the directory has r and X permissions so that you can list the directory and access its contents

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/77/3E/wKiom1ZljdCwnOFRAACNQZQDyaU968.png "style=" float: none; "title=" Rhce7-classroom-2015-12-07-21-40-33.png "alt=" Wkiom1zljdcwnofraacnqzqdyau968.png "/>


If you have only R permissions on the directory, you can list the names of the files in them, but other information, including permissions or time timestamp, is not available or accessible

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/77/3D/wKioL1ZljkCSkd5UAAB61TtRWZk468.png "style=" float: none; "title=" Rhce7-classroom-2015-12-07-21-41-41.png "alt=" Wkiol1zljkcskd5uaab61ttrwzk468.png "/>


If you have only x permission on a directory, you cannot list the names of the files in that directory, but if you already know the name of the file to which you have Read permission (you cannot use the TAB key to get the file name, of course), they can access the contents of the file by explicitly specifying a file name.

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/77/3E/wKiom1ZlkUfB1k2PAABrczSDRdU391.png "title=" Rhce7-classroom-2015-12-07-21-58-15.png "alt=" Wkiom1zlkufb1k2paabrczsdrdu391.png "/>





The meaning of the first 10 characters of a file:


650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/77/3E/wKiom1ZliHXz0HEUAAAowxE_APg639.png "style=" float: none; "title=" Rhce7-classroom-2015-12-07-21-21-25.png "alt=" Wkiom1zlihxz0heuaaaowxe_apg639.png "/>

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/77/3C/wKioL1ZliOTRO3URAAAsp6_2qOE112.png "style=" float: none; "title=" Rhce7-classroom-2015-12-07-21-22-25.png "alt=" Wkiol1zliotro3uraaasp6_2qoe112.png "/>



The first character represents the meaning:

C is a character device file

B is a block device file (disk file)

L is a symbolic link

P is a pipeline file

-it's a regular file.

D is the catalog file


The next 9 characters 3 are a set of left-to-right groups representing the owning group other

A group of press RWX, there is the corresponding permission to represent the use of the non--represents






Change File/directory permissions :


Symbolic method Keywords:


Command format: chmod Whowhatwhich file|directory


who refers to u (user) G (group) O (Other) a (all)


What means + (add)-(delete) = (exact setting)


which refers to R (Read) W (write) x (executable)

Note: The original permissions are overwritten

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/77/3D/wKioL1ZllTjQ6WgqAABiibJeheI703.png "style=" float: none; "title=" Rhce7-classroom-2015-12-07-22-06-24.png "alt=" Wkiol1zlltjq6wgqaabiibjehei703.png "/>


Numerical method:


Command format: CHOMD # # File|dircectory


Each number represents the access level: User Group Other


# is r=4 w=2 x=1 and

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/77/3D/wKioL1ZllayyYv0hAABftNawOGg728.png "title=" Rhce7-classroom-2015-12-07-22-17-59.png "alt=" Wkiol1zllayyyv0haabftnawogg728.png "/>

Changed from the original 775 to 751.


Note: For set permissions recursively in the entire directory tree, the chmod command supports the-r option, and when using this option, it is important to use the X permission instead of the X permission, which means that the Execute permission should be set only for the directory instead of the normal file. For example, the following command sets the recursive setting to read and write access to all child owners of/alice_file and its group owners, but only execution permissions apply to directories rather than plain files:


650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/77/3E/wKioL1ZlmefwjUKCAABftNawOGg773.png "style=" float: none; "title=" Rhce7-classroom-2015-12-07-22-17-59.png "alt=" Wkiol1zlmefwjukcaabftnawogg773.png "/>

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/77/3F/wKiom1ZlmXjhPdF5AABgHTSqobo293.png "style=" float: none; "title=" Rhce7-classroom-2015-12-07-22-34-04.png "alt=" Wkiom1zlmxjhpdf5aabghtsqobo293.png "/>





To change the ownership of a file/directory user or group:


Chown User name (you want to change) file/directory absolute path

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/77/3D/wKioL1ZllQ-jqRm3AABX68mjB6Q835.png "title=" Rhce7-classroom-2015-12-07-22-14-48.png "alt=" Wkiol1zllq-jqrm3aabx68mjb6q835.png "/>

Chown: Group name (to be changed) file/directory absolute path

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/77/3F/wKiom1ZllEWgMJueAABZywFsTTo654.png "style=" float: none; "title=" Rhce7-classroom-2015-12-07-22-09-15.png "alt=" Wkiom1zllewgmjueaabzywfstto654.png "/>

Or

Chgrp the file/directory absolute path of the group name (you want to change it)

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/77/3F/wKiom1ZllEayvNX7AABXobKuP0k473.png "style=" float: none; "title=" Rhce7-classroom-2015-12-07-22-11-35.png "alt=" Wkiom1zlleayvnx7aabxobkup0k473.png "/>

This article is from the Linux Learning Notes blog, so be sure to keep this source http://10516823.blog.51cto.com/10506823/1720563

Linux File system 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.