Permission management commands for linux study notes

1.chmod changes the permissions of the file, only the owner or root user can use it

   chmod {n,g,o,a} {+,-,=}{r,x,w} filename or directory

   {n,g,o,a} : n : other users g: group o: owner a: everyone

   {+,=,- } +:Add permission -:Remove permission =:Modify permission to

   chmod 421 filename

   r=4 w=2 x=1 For example, chmod 777 fileName changes the file permissions to wrxwrxwrx     

   -R Modify the permissions of the files in the folder, that is, the folder (recursive modification)

 

Permission description:

file (file)

r: readable, command cat less more head tail 

w: writable vi vim

x: executable script file, command.

 

dir (folder)

r: can list the file directory ls

w: delete the directory, create a file touch, mkdir, rm 

x: can enter the folder cd is generally synchronized with r

 

2. Change user owner (root only) 

   chown [user] [file or directory]

 

3. Change all groups of the file

chgrp [group name] [file or directory]

 

4. umask -s displays the default permissions for new files

   umask 0022

   Default permissions are 755 

  Logical AND of Method 777

    777  

    022

------------ 

    755 

  

 

 

 

 

 

 

 

 

 

   

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327053530&siteId=291194637