Linux Learning Notes (Group Management and Rights Management)

Introduction of Linux in the group

In the front we mentioned the concept of a group, which said, in Linux, each user must belong to a group, can not be independent from outside the group. In Linux every file there, all set of concepts owner, other groups.

File, directory owner

General file creator, who created the document, who is the owner of the file.

  • Owner to view the file
    command ls -ahl
    Here Insert Picture Description
  • Owner to modify the file
    command chown username filename
    Here Insert Picture Description
Create group

Command groupadd group name
Here Insert Picture DescriptionHere Insert Picture Description

Files, directories where the group

When a user creates a file, the default file where the group is the group to which the user is located.

  • Check the file directory where the group
    command ls -ahl

  • Modify the file's group
    instruction chgrp group file name

Here Insert Picture Description

Other groups

In addition to the user's group and owner of the file, other users of the system is a file that you love other groups.

Change the user's group

Command usermod -g group name username
command usermod -d directory name, user name (change the initial directory user login)
Here Insert Picture Description

Basic introduction and modification rights

  • Instruction ls -l view display is as follows

Here Insert Picture Description
Type (d, 1) to determine the file of 0 -., L, C, B)
. 2) bits 1-3 determine the owner (owner of the file) have access to the file
3) of 4- permission 6 to determine the owning group (the same group of users) owns the file
4). 7-9 bitdetermining rights owned by other users of the file

  • Detailed permission
    rwx role to file
    1). [R] representatives can read
    2). [W] representatives can write, you can modify, but not delete the file, delete the file precondition is the directory where the file write permissions to perform the deletion
    3). [x] can be carried out on behalf of

    rwx acting directory
    1). [r] Representative readable, LS can view the contents of the directory
    2). [w] Representative writable, can be modified, created in the directory, delete, rename
    3). [x] class representatives execution, you can enter the directory
    Here Insert Picture Description

Modify permissions

1) The instruction chmod u = rwx, g = rw , o = x file directory name (change permissions)
Here Insert Picture Description
2) The instruction chmod u + x file directory name (to add execute permissions to the file in the user group)

3). Instruction chmod a + x file directory name (the file for all users to add a.txt write permission)
Here Insert Picture Description
3) the instruction chmod 744 file directory name (corresponding to a set of permissions for each user or 3, converted to decimal)
Here Insert Picture Description
Here Insert Picture Description

Modify the file owner

Instruction owner of the file name after the chown modify
Here Insert Picture Description
instruction for all groups after the owner of the file name modification after modification chown
Here Insert Picture Description

Modify the file's group

Command file name of the file where the group after chgrp modified
Here Insert Picture Description

while studying records, if any deficiencies welcome message pointing ...

Published 63 original articles · won praise 1 · views 2026

Guess you like

Origin blog.csdn.net/qq_45061361/article/details/104616944
Recommended