Linux (11) Rights Management

Source: Internet
Author: User
Tags chmod readable

11.1 rwx Permissions Detailed 11.1.1 rwx effect to file

(1) "R" stands for readable (read): Can read, view.

(2) "W" for Writable (write): Can be modified, but does not mean that the file can be deleted, deleting a file if you have write permission to the directory where the file is located in order to delete the file.

(3) "X" means executable (execute): can be executed.

11.1.2 rwx effects to the directory

(1) "R" stands for readable (read): Can read, view.

(2) "W" stands for Writable (write): You can modify, create, delete, and rename directories within the directory.

(3) "X" means executable (execute): You can enter the directory.

11.2 Practical Cases
-rw-r--r--. 1 root root 26788 4月  14 16:53 java后端生活.jpg

? The preceding 10 characters -rw-r--r-- determine what different users can do with the file:

The first character represents a file type: File (-), directory (d), link (l);

The rest of the characters are each 3 groups (RWX):

First set of rw-: The permissions of the file owner are read and write, but cannot be executed;

Second set of r--: The permissions of the user in the same group as the file owner are read-only and cannot be written and executed;

Third group r--: the permissions of other users who are not in the same group as the file owner are read-only and cannot be written and executed;

The available numbers are expressed as: r=4,w=2,x=1; so rwx=4+2+1=7

1: File is a hard connection number, directory is a subtree

Root: User

Root: Group

26788: File Size (bytes), if folder is displayed 4096 bytes

April 14 16:53: Last Modified Date

Java back-end life. jpg: File name

11.3 Modifying permissions 11.3.1 basic instructions

With the chmod directive, you can modify the permissions of a file or directory

11.3.2 First way: + 、-、 = Change permissions

U: Owner

G: Group

O: Others

A: Everyone (sum of u, G, O)

(1) chmod u=rwx,g=rx,o=x file directory name

(2) chmod o+w file directory name

(3) chmod a-x file directory name




11.3.3 Second way: Change permissions by number

Rule: r=4,w=2,x=1,r+w+x=7

chmod u=rwx,g=rx,o=x file directory name

Equivalent to chmod 751 file directory name


11.4 Modify File Owner 11.4.1 Basic Introduction

Chown Newowner file Changes the owner

Chown Newowner:newgroup file changes the owner and group of files

-R If it is a directory, make all sub-files and directories under it recursively take effect




11.5 Modifying the group of files

CHGRP newgroup file changes the group in which the files are located



Linux (11) Rights Management

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.