Introduction to user and group management commands in Linux
Configuration files for users and groups in Linux mainly include passwd, shadow, group, and gshadow. The passwd user saves the user's account information and is readable to any user; The shadow detachment root user is readable; the group is a means to control the permissions of user groups, this file can be read by any user. gshadow is used to define the user's group password and Group Administrator information.
Common User management commands:
Add the user's command: useradd-u UID-g group name-d/home/group name-s/bin/bsh-e 2011/1/1 (expiration time) User Name (zhang)
Command to delete a user: userdel-r username
Modify the attributes of a user's account: usermod-l newusername username change the existing user name
Lock the specified username: usermod-L username
Unlock the Locked User: usermod-U username
Change User Password: passwd Password
Passwd related operations
Passwd-S username is used to query the status of the specified user's password, only available to the root user
Passwd-l username: the user locks the specified user
Passwd-u username user to unlock the relevant user
Passwd-d username is used to delete the password of a specified user, which is only available to the root user.
Related Management commands for group accounts:
Groupadd-r group name
Groupdel-r group name
Groupmod-r group name (Change Group attributes)
Command for gpasswd: the user adds or deletes the specified user from the group.
Command Format: gpasswd [parameter] user name group name
Gpasswd-a username groupname adds the specified user to the specified user group.
Gpasswd-d username groupname: delete a specified user from the group
Gpasswd-A usernmae groupname: Specify the specified user as the Group Administrator.