Common Linux commands (2) -- permission management commands

Source: Internet
Author: User

Common Linux commands (2) -- permission management command 1. Command name: chmod www.2cto.com execution permission: All Users Function Description: Change the file or directory permission Syntax: chmod [{ugo} {+-=}{ rwx}] [file or directory] [mode = 421] [file or directory] chmod user type add or remove permission file or directory pair the owner of file a adds the execution permission [root @ localhost abc] # chmod u + x a minus the read permission for others in file a [root @ localhost abc] # chmod o-r set the read/write permission for the group to which file a belongs [root @ localhost abc] # chmod g-rw a www.2cto.com authorize rwx read/write execution r ---> 4, w ---> 2, x ---> 1 For example: rwxr-xr -- this permission corresponds to 754 rw-r-x -- x. This permission corresponds to 651 setting of rwx for the owner of File a, and rw -, if the read permission of another user is r --, the corresponding number is 754 [root @ localhost abc] # chmod 764 a. a user has write (w) permission on a directory, this means that you can create and delete files in this directory, even if the user does not have the write (w) permission on the files in the directory. 2. Command name: chown execution permission: all user features: change the owner Syntax of a file or directory: chown user [file or directory] changes the owner of file a to luxh [root @ localhost abc] # chown luxh a 3. Command Name: chgrp execution permission: All Users Function Description: Change the group Syntax of a file or directory: chgrp [user group] [file or directory]: Change the group to adm [root @ localhost abc] # chgrp adm a [root @ localhost abc] # ls-l a-rwxrw -r --. 1 luxh adm 0 Nov 15 a 4. Command name: umask execution permission: All Users Function Description: Display and set the default file permission Syntax: umask [-S]-S displays the default permission for creating a new file or directory in the form of rwx [root @ localhost abc] # umask0022 [root @ localhost abc] # umask-Su = rwx, g = rx, o = rx [root @ localhost abc] #0022 meaning: 0 -- Special Permission bit; 022 -- user permission bit, permission mask value, the actual permission value is 777-022 = 755 use: umask mask value can change this value, but it is not recommended to change this value Linux permission rule: the default file creation cannot be granted executable (x) permission

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.