Basics of Linux: Linux permission mechanism

Source: Internet
Author: User
Basic for Linux: Linux permission mechanism permission is a mechanism used by the operating system to restrict access to resources. permissions are generally divided into read, write, and execution. Each file in the system has specific permissions, users, and groups. this mechanism is used to restrict users and groups that can be specific files... basic for Linux: Linux permission mechanism permission is a mechanism used by the operating system to restrict access to resources. permissions are generally divided into read, write, and execution. Each file in the system has specific permissions, users and groups. this mechanism is used to restrict users and groups that can perform operations on specific files. Each process runs as a user, so the process has the same permissions as the user. the higher the user's permissions, the more permissions the process has. Effect of file permission on file on directory r (read) readable file content can List directory content w (write) the file content that can be modified can be created and deleted in the directory. the file x (executed) can be used as a command to execute the accessible directory content directory. the directory must have the x permission; otherwise, the file content cannot be viewed. X is also called acl ugo Linux permission control based on UGO model: U stands for User, G stands for Group, O indicates that the permissions of each Other file are set in three groups (rwx) based on UGO. For UGO, each file has a user and a group corresponding to UG, run the "ls-l" command to view the file information in the current directory. if the file does not belong to the user or group, run the "drwxrwxr-x 2 shuangde 4096 00:33 hdu-rw- r -- 1 shuangde 26 August 24 22:50 input.txt drwxrwxr-xd: file type. "d" indicates a directory. "-" indicates the rwx: U permission for a common file. "rwx: G permission" indicates the r-x: Other permission. "-" indicates the user who does not have the permission to modify the file, group Command chown (change own) is used to change the user of the file $ chown shuangde test. Cpp sets test. the user of the cpp file is changed to the shuangde-R parameter to recursively modify the user command chgrp (change group) of all files in the directory to change the group of the file: $ chgrp lab104 test. cpp sets test. modify the Group of the cpp file to lab104-R parameters recursively modify the group of all files under the Directory Change permission command chmod to modify the file permissions $ chmod mode file mode is in the following format: u, g, o stands for the user respectively, and group and other a can represent ugo +.-represents adding or deleting the corresponding permissions r, w, x represents three permission examples: $ chmod u + rw test. cpp sets test. rw $ chmod g-x test. cpp sets test. delete x $ chmod go + r test. cpp sets test. r$ chmod a-x test is added to the cpp Group and other permissions to test. cpp The command chmod also supports modifying permissions in the numeric (binary) mode. The three permissions are represented by three numbers:-r = 4 (2 ^ 2) -w = 2 (2 ^ 1)-x = 1 (2 ^ 0) is actually based on binary: 111, each representing the location in the same sequence of rwx. if this bit is 0, this permission is not granted. No permission = 0 when a number is used to indicate the permission, each group is the sum of the corresponding numbers: rw = 4 + 2 = 4 | 2 = 6rwx = 4 + 2 + 1 = 4 | 2 | 1 = 7r-x = 4 + 1 = 4 | 1 = 5 so, use a number to indicate that the ugo permission is represented as follows: chmod 660 test. cpp is equivalent to rw-rw ---- chmod 775 test. cpp is equivalent to rwxrwxr-x
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.