Linux User and Authority Management Commands

Source: Internet
Author: User
Keywords linux linux user management linux user management commands
Abstract: This article mainly introduces the classification of permissions in the Linux system and the management of permissions.

The three identities of users


Since Linux is a multi-person and multi-work system, it may often happen that multiple people use this host for work at the same time. In order to consider everyone’s privacy and everyone’s preferred working environment, the owner’s The role is quite important.

In some cases, the file owner can set the file so that only the owner can access and modify the file, so other people cannot access and modify the file.

Belonging to the group

The belonging group is a logical collection of users with the same characteristics.

Simply understand, sometimes we need to allow multiple users to have the same permissions, such as the permission to view and modify a file. One method is to authorize file access to multiple users separately. If there are many users, this method will perform a lot of meaningless repeated operations. Another way is to create a user group, let this group have the authority to view and modify this file, and then put all users who need to access this file into this group, then all users have the same authority as the group.

other people

Other users who are neither the owner nor in the group they belong to are classified as other people.

File attributes

Use the ls command to view file attributes

Use the ls -al command to view the file attributes of all files:

[root@localhost home]# ls -al
Total amount 36
drwxr-xr-x. 3 root root 93 July 11 03:56.
dr-xr-xr-x. 17 root root 4096 July 3 16:12 ..
-rw-r--r--. 2 root root 10240 July 11 01:28 hello
-rw-r--r--. 2 root root 10240 July 11 01:28 hello-hard
lrwxrwxrwx. 1 root root 5 July 11 03:56 hello-soft -> hello
-rw-r--r--. 1 root root 506 July 11 02:27
-rw-r--r--. 1 root root 308 July 11 02:39
drwxr-xr-x. 4 root root 33 Jul 11 03:53 zip
[root@localhost home]#

You can see that the content format of each line is the same. Take the first line as an example:

1) First of all, the first column drwxr-xr-x indicates the file type and permissions.

2) The second column 3 indicates the number of file connections. Hard links will increase this value, soft links will not.

3) The third column of root indicates the owner of the file.

4) The fourth column root indicates the user group of the file.

5) The fifth column 93 indicates the size of the file, the unit is Byte.

6) The sixth column July represents the month when the file was last modified.

7) The seventh column 11 indicates the date when the file was last modified.

8) The eighth column 03:56 indicates the time when the file was last modified.

9) The ninth column. Represents the name of the file. If the file name starts with ".", it means that the file is a hidden file.

File type and permissions

It is important to note that in the first column of file attributes, drwxr-xr-x is used to indicate the type and permissions of the file. This column has a total of 10 characters, and its meaning is as follows:

1) File type

The first character "d" indicates that the file type is a directory file. Common file types are as follows:

-: Regular file (file).
d: directory file (directory).
b: Block device files, such as hard disks. Support random access in block units.
c: character device file (character device), such as a keyboard. Supports linear access in units of character.
l: Symbolic link file (symbolic link), also known as soft link file.
p: named pipe file (pipe).
s: Socket file (socket), used to implement communication between two processes.

2) File permissions

In the following characters, three are a group, and they are all combinations of the three parameters "rwx". Among them, "r" means readable (read), "w" means writable (write), and "x" means executable (execute). Note that the position of the three parameters of "rwx" will not change. If there is no corresponding permission, use "-" instead.

1 The first group of rwx is the owner's permission, which means that it is readable, writable and executable.
2 The second group r-x is the authority of the group to which it belongs, which means that it is readable but not writable and executable.
3 The third group r-x is the authority of others, which means that it is readable but not writable and executable.
Related Article

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: 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.