linux-change file attributes and permissions

There are three types of permissions in the Linux system: owner, group, and others, which have permissions to operate files. Each type of user has three permissions: r w x.

       r(read)

       w(write)

       x(execute)

      For directories, it is not enough to set the r permission. Other users need to have r and x permissions to enter a directory. Only with x permission can they switch to the directory.

1. Common commands for modifying file attributes and permissions

       chgrp: change the group a file belongs to

       chown: change file owner

       chmod: change file permissions

   1、chgrp group  file/folder

         -R means that subdirectories will be processed recursively    

         chgrp users aa.txt aa.txt is modified to users permission group

   2、chown  user file/folder

        -R recursively process subdirectories

        chown user:group file/folder can specify the user to which the file belongs and the group to which it belongs

   3, chmod is used to modify the permissions of the file

          There are nine basic permissions for linux files, respectively termed owner/group/others:

          Where: r 4; w 2; x 1 Permissions can be set numerically for the file.

          Set document permissions in a combination of numbers:

          The format of the command is the same as that of chgrp chown, and the document permissions can be set by a combination of numbers, such as:

          chmod [-R] 777 aa

          Change file permissions via symbols:

                     u     user  

                     g     group

                     o     others

                     a     all

           Format: chmod [ugoa] [+ -=] [r w x] file

            E.g:

                   chmod o-wx aa others users only have the read permission of aa, removing the write and run permissions

 

 

 

  

Guess you like

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