User and Rights Management in Linux
Unlike window's single-user system, the Linux operating system is designed to follow a multi-user, multi-tasking philosophy. In this case, the security issue is very important, different users, different user groups between the privacy protection, security management is very necessary. For this problem, Linux has a different user, different groups for the file has the permissions to use to ensure security.
User's concept
User: Since the Linux system is a multi-user system, each user has a different group. In order to facilitate the management of users, so when we register the account, the system will automatically assign us an ID to identify the uniqueness of this user. The ID information is generally stored in the/etc/passwd file. Each logged-on user will get at least two IDs, one is the user Id,uid, the other is the group Id,gid, and the file determines its owner and group is the use of UID and GID.
Depending on the permissions, the Linux system divides the user into the Administrator account, the system account, the general account, and identifies with the GID and UID.
Root user, i.e. administrator, Auto Assign, uid=0,gid=0
CentOS7 system, System account UID range: 1-999
Normal User UID Range: 1000-60000
System account GID Range: 1-999
Normal user gid range: 1000-60000
We can use the ID command to query the corresponding user's information: ID username
[[email protected]/]# ID ZHANGPF
uid=1000 (ZHANGPF) gid=1000 (ZHANGPF) group =1000 (ZHANGPF), ten (wheel)
As shown above: The UID value of user ZHANGPF is 1000,gid value is 1000, the group that belongs to is ZHANGPF, additional group is wheel
User management, typically only administrators have this permission. The common commands are
Useradd: Adding users, and configuring user information
Userdel: Deleting users
passwd: Set user password, change password
Usermod: Account-related data fine-tuning to add multiple groups to a single user
Figer: Similar fingerprint function, able to query the user's related properties
User Group Management:
Groupadd: Adding user groups
Groupmod: Similar to the usage of usermod, modify the relevant parameters of the group
Groupdel: Deleting a group
GPASSWD: User group Administrator function
Note: For administrative and group management of users, only administrators typically have this permission.
File attributes and permissions: For Linux systems, the philosophy of "Everything is a file" is treated as a file, whether it is a hardware resource or all other resources. Each file has attributes, and has different permissions for different users. In Linux, you can use the LS command to view the properties of a file:
[Email protected]/]# ls-l
Total Dosage 44
lrwxrwxrwx. 1 root root 7 February 17:28 Bin--Usr/bin
Dr-xr-xr-x. 4 root root 4096 February 17:38 boot
Drwxr-xr-x. Root root 3260 March 8 10:29 Dev
Drwxr-xr-x. Root root 4096 March 8 14:08 Home
Drwxr-xr-x. Root root 960 March 8 10:29 Run
lrwxrwxrwx. 1 root root 8 February 17:28 sbin-Usr/sbin
-RW-------. 1 root root 0 February 17:27 yum.log
As shown above: The first line listed is the file's properties and permissions,
lrwxrwxrwx: The first character represents the properties of this file
L on behalf of linked files
D Stands for Directory
-Representative documents
b indicates the storage interface device inside the device file.
c indicates a serial port device in the device file, such as a keyboard, mouse
The next set of three is a group, and all of the "rwx" of the 3 parameter combinations, where "R" stands for the readable, "w" for the Writable, "X" for the executable
The preceding three represents the owner's permission, the middle permission is the group, and finally the other person (other) 's permissions
The second column indicates how many file names are connected to this node
The third column represents the owner name of the file
The fourth column represents the name of the group that the file belongs to
The fifth column is the size of the file, the unit is B
The No. 678 column represents the date on which the file was recently changed
The Nineth column is the file name
Unlike Windows systems, each file has a variety of attributes added, especially under multi-user systems, where everyone has access to the appropriate permissions to secure the data. So before you modify the properties of files and directories, be cautious!!! So how do the permissions for files and directories change?
CHGRP: Changing the user group to which the file belongs
Chown: Changing the file owner
chmod: Changing the permissions of a file
This article is from the "11283159" blog, please be sure to keep this source http://11293159.blog.51cto.com/11283159/1749705
Linux Basics: Users and groups, rights management