Linux chmod command

Source: Internet
Author: User

@ chmod Changing the access mode of one or more files

chmod [options] mode files

Only the file owner or special user can use this function to change the file access mode. Mode can be expressed in digital form or who opcode permission form. Who is optional and the default is a (all users). Only one opcode (opcode) can be selected. Multiple mode can be specified, separated by commas.

Options

-C,--Changes

Only the changed information is output

-F,--slient,--quiet

-f,--silent,--quiet when chmod cannot change the file mode, the user who does not notify the file  --help output help information.  -r,--recursive can recursively traverse subdirectories to set permissions for all files and subdirectories under the directory  --reference=filename refer to filename permissions  -v,-- Verbose regardless of whether the modification is successful, output information  --version output version information for each file.  who u User  g Group  o other  a all users (default)  opcode + Add permissions  -Remove permissions  = reassign permissions   Permission r Read  w Write  x execute  s set User (or group) ID number  t set sticky bit (sticky bit) to prevent files or directories from being non-primary delete  u user's current permissions The current permissions of the  G group  o other users ' current permissions   as a choice, most of us use the form of three-bit octal digits to represent permissions, the first to specify the owner's permission, the second to specify the group permissions, the third to specify the permissions of the other user, each pass 4 (read), 2 (write), 1 ( Execute) Three numeric values and to determine the permissions. If 6 (4+2) represents a read-write right, 7 (4+2+1) has read, write, and execute permissions.   can also set the fourth bit, which is in front of the three-bit permission sequence, and the fourth digit value is 4,2,1, which means:  4, set the user ID at execution time to authorize the file owner-based process, not to the user who created the process.  2, when executed, sets the user group ID, which is used to authorize processes based on the group of files, rather than on the user who created the process.  1, set the sticky bit.   Example:  $ chmod u+x file                   to file owner increase execution rights $ chmod 75 1 file                   To assign read, write, execute (7) permissions to the owner of file, assign Read, execute (5) permissions to the group where the file is located, and Permissions for user assignment Execution (1) $ chmod U=RWX,g=rx,o=x file       The other form of the above example $ chmod =r file                 User assigned Read permissions $ chmod 444 file               Same case $ chmod a-wx,a+r   file   &NB  Sp   Example $ chmod-r u+r directory         Recursively read permissions to all files and subdirectories in the directory directories under chmod 4755   &NBS P                       Set the ID to assign read, write, and execute permissions to the owner and assign read and execute permissions to the group and other users.

Linux chmod Command

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.