[Linux Learning Notes] Linux Common commands-rights management commands

Source: Internet
Author: User

Linux Rights Management commands
1. Change file or directory permissions: chmod
Command name: chmod command English Original: Change the permissions mode of a file command where the path:/bin/chmod Execute permissions: All user syntax: chmod [{ugo} {+-=} {rwx}] [file or directory] [mode=421] [File or directory] Function description: Change file or directory permissions
Representative character Permissions The meaning of the file The meaning of the directory
R Read permissions Can view the contents of a file You can list content in a directory
W Write permissions Can modify the contents of a file You can create and modify files in the directory
X Execute permissions Can execute file Access to Directory

File:

Read Permissions R operation : Cat, More, head, tail;  Write permission W operation: Echo, VI; Execute permissions x: command, script

Directory:

Read Permissions R operation: LS (List contents in the directory);  Write permission W operation: touch, mkdir, RM; Execute permissions x: CD

2. Change the file owner: Chown
Command name: Chown Command English Original: Change file ownership command path:/bin/chown Execute permissions: All user syntax: chown [user] [file or directory] function description: Changes the owner of the files or directories
3. Change the owning group of the file or directory: Chgrp
Command name: CHGRP Command English Original: Change file group Ownership command path:/BIN/CHGRP Execute permissions: All user syntax: chgrp [user] [file or directory] function description: Changes the group of files or directories belonging to
4. Default permissions for display, device files: umask
Command name: Umask command in English: command path:/bin/umask Execute permissions: All user syntax: Umask [-S]-s to display new file or directory default permissions in rwx form umask [permission mask value] Modify default Permissions function Description: Display, set file The default permissions

Example:

[Email protected] test]# umask-su=rwx,g=rx,o=rx[[email protected] test]# umask0022

Description: the umask command returns 0022, the first bit 0 represents the special permission bit, the latter three bits 022 represents the user permission bit, is the permission mask value , and its permission should be 777 minus its value.

Note: Linux permissions rule: Files created by default cannot grant executable x permissions

[Linux Learning Notes] Linux Common commands-rights management commands

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.