Introduction to some knowledge about Linux rights Management

Source: Internet
Author: User
Tags chmod readable file permissions

Rights Management

Read,write,execute
R,w,x Read and write execution
File
R: For files, you can display their content by using the commands for the content view class
W: You can use the editor to modify its contents
X: You can initiate a process

Directory
R for directory reading you can use LS to view file information inside a directory, including subdirectories
W can create a delete file
X you can use the LS-L command to view information about the contents inside the directory, and you can use the CD command to switch to this directory

If the user does not have a bit permission, the-placeholder is used to indicate that there is no
R-x is readable executable only
r--only read-only permission
Rw-can only be read and writable

[Root@docker-node1 ~]# Ls-l
Total 8
-rwxr-xr-x. 1 root 134 Dec 2040 in.sh

-rwxr-xr-x. 1 root 134 Dec 2040 in.sh
The owner is a read-write execution, belongs to the group write and executes, the other user is the execution authority

This change can be expressed in numbers, if there is a 1, if not 0, no use-placeholder:
---0 no permissions
001:--x 1 Execute Permissions
010:-w-2 can be written in full line
011:-WX 3 writable execution rights
100:r--4 read-only permissions
101:r-x 5 Readable executable
110:rw-6 Readable and writable permissions
111:RWX 7 Readable writable executable

Readable writable executable is: rwxrwxrwx 777
Readable writable permission is: rw-rw-rw-666
Read Only: r--r--r--444
Read execution is: R-xr-xr-x 555
By analogy

The owner group that modifies the file only administrators have permission: CHOW,CHGRP
Change file permission: chmod
To manipulate the permissions of three types of users, use the octal form, manipulate the permissions of the specified category user, authorize with u,g,o,a, and can be based on = or + +, and can be authorized for the current file with reference to other file permissions

[Root@docker-node1 ~]# LL
-rwxr-xr-x. 1 root 134 Dec 2040 in.sh
[Root@docker-node1 ~]# chmod 754 in.sh
[Root@docker-node1 ~]# ll in.sh
-RWXR-XR--. 1 root 134 Dec 2040 in.sh
If the given permission octal is not enough three bits, it will only give the right to the permissions, the way is actually not ideal. As follows:

[Root@docker-node1 ~]# chmod 6 test/
[Root@docker-node1 ~]# ll-ld test/
d------rw-. 2 shutdown root 6 08:05 test/
[Root@docker-node1 ~]#
Table of Contents: When we modify the permissions of a directory, it does not modify the permissions within its directory, if you modify its internal permissions then-R, but invalid for the symbolic link file

ACTION specifies the type of user right:
U: Owner
G: Genus Group
O: Other
A: All
=: Manipulate permissions for user of specified category
+ +: Manipulating individual permissions for a specified category user

Operation U Owner

[Root@docker-node1 ~]# chmod u=rwx test/
[Root@docker-node1 ~]# ll-ld test/
DRWX---rw-. 2 shutdown root 6 08:05 test/
[Root@docker-node1 ~]#
Of course, you can also use together:

[Root@docker-node1 ~]# chmod ug=rwx test/
[Root@docker-node1 ~]# ll-ld test/
drwxrwxrw-. 2 shutdown root 6 08:05 test/
[Root@docker-node1 ~]#
If the owner group has inconsistent permissions, it can be written separately

[Root@docker-node1 ~]# chmod u=rwx,g=r,o= test/o= If you do not have permissions, you do not write, you can also r recursively modify
[Root@docker-node1 ~]# ll-ld test/
DRWXR-----. 2 shutdown root 6 08:05 test/
[Root@docker-node1 ~]#
/+ Usage: u-x,g+r,o-x,+x
Modify individual permissions. The following +RW
u=,ug=,o=,g=

[Root@docker-node1 ~]# chmod-r g+rw,o= docker/
[Root@docker-node1 ~]# ll-ld docker/
DRWXRW----. 2 Root 08:12 docker/
-A All
[Root@docker-node1 ~]#
If you want to add X permissions to the owner group, you can do the following (note that once-a is all changed to the right referred to by-A, the original will be overwritten):

[Root@docker-node1 ~]# chmod-r a=x docker/
[Root@docker-node1 ~]# ll-ld docker/
D--x--x--x. 2 Root 08:12 docker/
[Root@docker-node1 ~]#


+x, usually +x will become executable file, color will be green

[Root@docker-node1 ~]# chmod +x anaconda-ks.cfg
[Root@docker-node1 ~]# ll-ld anaconda-ks.cfg
-rwx--x--x. 1 root 932 June 13:19 Anaconda-ks.cfg
[Root@docker-node1 ~]#


Referential permissions, referential modifications

[Root@docker-node1 ~]# Ll-l
Total 8
-rwx--x--x. 1 root 932 June 13:19 Anaconda-ks.cfg
D--x--x--x. 2 Root 08:12 Docker
-RWXR-XR--. 1 root 134 Dec 2040 in.sh
-r-xr-xr-x. 1 Root 0 14:23 Linuxea
DRWXR-----. 2 Shutdown root 6 08:05 test
[Root@docker-node1 ~]# chmod--reference=/root/in.sh/root/anaconda-ks.cfg
[Root@docker-node1 ~]# ll-ld in.sh anaconda-ks.cfg
-RWXR-XR--. 1 root 932 June 13:19 Anaconda-ks.cfg
-RWXR-XR--. 1 root 134 Dec 2040 in.sh
[Root@docker-node1 ~]#

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.