Concepts for users and groups
Each user has a userid, the operating system actually uses the user ID, not the user name each user belongs to a primary group, and is restricted by resources accessible to that user each group has a GroupID each process runs as a user and is restricted by the resources that the user can access Each logged-on user has a specified shell user
The user ID is 32 bits, starting at 0, but for compatibility with older operating systems, user IDs are limited to 60000-root users, users with ID 0-system User 1-499-Normal user 500 more files in the system have a user ID and a owning group command to display the current user's information use the passwd command to modify the current user password
Files related to user information
/etc/passwd//[1. User name, 2.x means that the user password is stored in shadow, 3. User ID number, 4. Group ID, 5 user description information, 6 user's home directory, 7. User's login shell, which is actually bash under bin/etc/ Shadow//[1 username, 2. Password, ... Indicates that the user has not created a password (divided into 3 parts, separated by $, and the first 6 is the 512-bit encryption of SHA)]/etc/group [group user name, group password, group ID]
WHOAMI Display Current User
Who shows users who sign in to terminals
Pts/0 is the graphical interface w shows those users logged in and can also show what they're doing
Create a user
Useradd username//Create a username [above this command or do the following: 1. Add user information in/etc/passwd 2. If you use the passwd command to create a password, the password is encrypted in/ect/shadow 3. Create a new home directory for your users /home/xxx 4. Copy the files in/ect/skel to the user's home directory in 5. Set up a group with the same user name, the default user belongs to this group of the same name "command Useradd support the following parameters-D specify home directory-S Modify login Shell-u specify UID-G designate primary Group-G subordinate Group (up to 31)
passwd + username//create password for a user usermod use to modify user information Usermod parameters username-l Update user name usermod-l new username old username-u update userid-d user home directory location-G user belongs to Primary Group-L lock user so that it cannot log on-u unlock-G specify subordinate group Userdel users delete a user (keep the user's home directory) userdel-r users delete users and users ' home directory
Group (general Use Department, function or geographical area to classify)
Each group has a group ID group information saved in/etc/group each user has a primary group, and can also have up to 31 subordinate groups Groupadd Group name add a group groupmod-n new group name old group name modify group name groupmod-g new ID old ID modify Group I D Groupdel Group name can delete a group