Common commands for Linux permission management

Source: Internet
Author: User

Preface


The previous blog summarized the linux File Management and summarized the linux File Permission management today! (4W1H Mode)

1. For example


(Fig. 1.1)

You are familiar with this figure. Let's talk about permission management!

2. File Types and permissions


Let's take a look at section 1.1 first. Let's look at the first column,

File Type:
-: Common file (f)
D: directory file
B: block Device Files)
C: character device file (character)
L: symbolic link file)
P: Command pipeline file (pipe)
S: socket File)


File Permission:

A total of 9 bits, each with three bits, each with rwx (read, write, and execute). For example, the permission of the message file is rw-r --

As we have mentioned above, the permissions of files are divided into three groups. What do these three groups represent?

Group 1: file owner Permissions

Group 2: permissions of the group to which the file belongs

Group 3: permissions of other users

Now we know that there are three groups of file permissions: You can set rwx (read, write, and execute), so let's take a look at what commands can be used to set these permissions and attributes!

3. Permission-related commands


Chown: Change the file owner


Chgrp: Change the group to which the file belongs


Chmod: changes the file permissions, SUID, SGID, SBIT, and other features

 


(1). chown

Chown [-R] Account name: group name file or directory options and parameters:

-R: Perform recursive changes, that is, all files under the directory are changed.

For example, chown root install. log

 


(2). chgrp

Chgrp [-R] dirname/filename... options and parameters:


-R: Perform recursive changes, that is, update all files and directories under the sub-directory to the group.

Example: chgrp test install. log

Note: chown root: root install. log can change the file owner and group (#:#)

  • 1
  • 2
  • Next Page

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.