Linux Common commands-rights management commands

Source: Internet
Author: User

Rights Management Command: chmod

Command name: chmod

Command English Original: Change the permissions mode of a file

Command path:/bin/chmod

Execute Permissions: All Users

Syntax: chmod [{ugoa}{+-=}{rwx}] [file or directory]

[mode=421] [File or directory]

-R Recursive modification

Function Description: Change file or directory permissions

Note

1.U: Owner (user); G: Group; O: Other person (other); +: Increase permissions;-: reduce permissions; =: permission is; r: readable; w: writable; x: executable;

2. Digital representation of permissions

R = 4; W = 2; x = 1 rwxrw-r--= 764; r-x-wx-w-=532;

    

    What the rwx of files and directories mean

File: r:cat/more/head/tail/less

W:vi

X:script command

Directory: R:ls

W:touch/mkdir/rmdir/rm

X:cd

Example: chmod g+w,o-r japanlovestory.list

chmod g=rwx Japanlovestory.list

chmod 640 Japanlovestory.list

Chmod-r 777/tmp/a (recursively modifies the permissions of all directory files under the A directory)

Other Rights Management commands

Command name: Chown

Command English Original: Change file ownership

Command path:/bin/chown

Execute Permissions: All Users

Syntax: chown [user] [file or directory]

Function Description: Change the owner of the file or directory (only root has this permission)

Command name: CHGRP

Command English Original: Change file group ownership

Command path:/BIN/CHGRP

Execute Permissions: All Users
Syntax: chgrp [user Group] [file or directory]

Function Description: Change the file or directory belongs to group example: Chgrp liming Fengjie

Command name: umask

Command English original: the User file-creation mask

Command path: Shell built-in command

Execute Permissions: All Users

Syntax: umask [-S]-s to display new file default permissions rwx

Function Description: Display, set default permissions for files

Example: Umask-s (view default permissions for user-created directories, create a file that does not have umask Execute permissions by default)

Umask 0022 (Show user's permission mask) 022 = 777-755 755 for actual permissions

Umask 022 (set user's permission mask)

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.