Role classification of users under Linux
Superuser: Has the highest administrative rights to the system and is the root user by default.
Ordinary users: Only the files under their own directory access and modification, with the permission to log on the system.
Virtual users: Also known as ' pseudo ' users, the biggest feature of this type of users is the inability to log on the system, their existence is mainly for the convenience of system management, to meet the corresponding system process of the file attributes. For example, the default user of the system: Bin, ADM, nobody user, and so on. Generally run Web services, the default is to use nobody users, but nobody users can not log on the system.
User and group relationships:
Single-to-one: a user can exist in a group, or it can be the only member in a group.
One-to-many: a user can exist in more than one user group, and this user has common permissions for multiple groups.
Many-to-one: multiple users can exist in a group that has the same permissions as the group.
Many-to-many: multiple users can exist in more than one group. is actually the extension of the above three correspondence relationship.
User Profiles Overview
The system user profile is the most important file in user management. This file records some of the basic properties of each user in the Linux system and is readable for all users. Each row in the/etc/passwd corresponds to a user, and each record is separated by a colon.
The following file is a partial output of the/etc/passwd file
650) this.width=650; "src=" http://s5.51cto.com/wyfs02/M01/7D/8A/wKiom1bqUtjzTASxAAAplC_r6cg714.jpg "title=" 11.jpg "alt=" Wkiom1bqutjztasxaaaplc_r6cg714.jpg "/>
User name: Password: User identification number (UID): Group identification Number (GID): annotative Description: Home directory: Default Shell
The following file is/etc/shadow file
650) this.width=650; "src=" http://s1.51cto.com/wyfs02/M00/7D/8A/wKiom1bqVY_zQ1GvAAA6R_09bj0197.jpg "title=" 1.jpg " alt= "Wkiom1bqvy_zq1gvaaa6r_09bj0197.jpg"/>
User name: Encrypted password: Last access time: Minimum interval: Maximum interval: warning Time: Inactivity time: Expiration time: Reserved field
The following file is the/etc/group user group where all the information is placed in the file
650) this.width=650; "src=" http://s1.51cto.com/wyfs02/M02/7D/88/wKioL1bqWBXDLTUGAAAai4PqT9U029.jpg "title=" 3.jpg " alt= "Wkiol1bqwbxdltugaaaai4pqt9u029.jpg"/>
Group name (cannot be duplicated): Password: Group ID (GID): List of users in the group
Introduction to User management tools
Groupadd/newgrp/groupdel
Groupadd: Used to create a new user group
NEWGRP: Used to switch between multiple users
Groupdel: Used to delete user groups
Useradd/usermod/userdel
Useradd recommended process for users
Usradd when creating a user without any parameters, the system first reads the profile/etc/login.defs and/etc/default/useradd used to add the user, adding the user based on the rules defined in the two configuration files. The user and user group records are then added to the/etc/passwd and/etc/group files, and the/etc/passwd and/etc/group corresponding encrypted files are automatically generated. The system will then automatically recommend the home directory under the directory set by the/etc/default/useradd file. Finally, copy all the files from the/etc/skel directory to the new user's home directory, so a new user is advised.
Usermod Modifying the user's account attribute information
Userdel Delete User, if you specify the-r parameter not only delete the user, but also delete the user's home directory and all files under the directory
Settings for files and permissions
650) this.width=650; "src=" http://s5.51cto.com/wyfs02/M02/7D/8E/wKiom1bqce_ACQlCAABybHQt05U824.jpg "title=" 4.jpg " alt= "Wkiom1bqce_acqlcaabybhqt05u824.jpg"/>
For file: R Read W write X Execute
For directory: R Read (see what's in the directory)
W build file, delete, move
X Enter
Related commands for modifying permissions:
chmod
Role: Modify file permissions
U+rUser owner
G-w Group
O=x Other people
A+x All
Use numbers to represent permissions
-rwx r-x r-x user1 user1 FILENAME
Permission of the type owner belongs to the group the permission of the other person belongs to the primary group object
Rwx
R---W--x
010 001 binary Binary Converter
4 2 1 decimal
0 means no permissions
1 means executable equals x
2 indicates writable equivalent W
4 = readable equivalent R
What is the value of rw-? 4+2=6
R-x4+1=5
What is the value of rwxr-xr-x? rwx=4+2+1=7 r-x=4+1=5 r-x=4+1=5 rwxr-xr-x=755
Using Chown to change the host group
Example 1: Modify the hidden file. Bash_logout belongs to Oracle, and the user group to which it belongs is Onstall.
650) this.width=650; "src=" http://s5.51cto.com/wyfs02/M02/7D/8B/wKioL1bqd3HQkLLxAABh7QXepsY066.jpg "title=" 6.jpg " alt= "Wkiol1bqd3hqkllxaabh7qxepsy066.jpg"/>
Example 2: To modify the Zhang directory and the directory under which all files belong to the user is root, the user group belongs to the DBA Group
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/7D/8B/wKioL1bqeRKicJGMAABQjurwqNE560.jpg "title=" 7.jpg " alt= "Wkiol1bqerkicjgmaabqjurwqne560.jpg"/>
Linux User Rights (essays)