Linux basic operation --- permission management command

Change file or directory permissions (1)

chmod [(u / g / o / a) (+ / - / =) (r / w / x)] [file name or directory name]

First create a new document, and use the ls command to view his permissions (the first three are user permissions, the middle three are the permissions of the group, and the last three are other user permissions)

It can be found that the owner of the file only has read and write permissions, and then I use the chmod command to give it executable permissions

Then check to see that there is an x ​​executable permission behind the user permission

chmod u + x myblog.txt // Increase the execution permissions for the owner of the file

Permission content:

first letter:

u stands for "user", that is, the owner of a file or directory.

g means "group users", that is, all users with the same group ID as the file owner.

o means "other (others) user".

a means "all (all) users".

Joiner:

+ Add a permission.

- cancel a privilege.

= Give the given permission and cancel all other permissions (if any).

Change file or directory permissions (2)

chmod [three numbers] file or directory

 r----4      w----2      x----1

The first number represents the owner's authority, the second is the authority of the group, and the third is the authority of others

First check the file permissions

 

Then change permissions

Change the owner permissions to read and write (r + w) = (4 + 2) = 6 and so on

Permission to modify files or directories recursively (that is, permissions to modify all files in the directory)

chmod -R [three numbers] file or directory

In Linux systems, read and write permissions are not exactly equal to the read and write operations in our common sense

rxw's operation authority on files:                                                  rxw's operation authority on directories:  
       : cat/more/head/tail/less                                                     : ls
       w : vim                                                                                  : touch/mkdir/rmdir/rm 
       : script/command                                                               x : cd
 

 

Guess you like

Origin www.cnblogs.com/cherish-hao/p/12685151.html