User Management Utility commands (version 2)
User management commands
Pwck # detect the/etc/passwd file # If the/etc/passwd is incorrect, the system will prompt
Vipw # edit the/etc/passwd file. The only difference between vipw and VI will lock the/etc/passwd file.
Id # view User id and group information
Finger [username] # view User details [you may need to install it on your own]
Su switching user # added-there will be an environment variable to switch to the Home Directory [added-,-left and right spaces], while su will not
Passwd-S [username] # view the User Password status
Passwd-d # delete user password
Passwd-l or usermod-L # Lock the user
# Usage: for example, this user has violated regulations and does not need to be used for a long time. Principle Analysis: add one or two more passwords to the/etc/shadow file! Because the length of the md5 encryption password is fixed, in this case, the password cannot match!
Passwd-u or usermod-U # unlock a user
Who, w # view the current login user information, w displays more details
Up indicates the time when the system is running.
Users logging on locally: ppy1, ppy2...
Remote login users: pts/1, pts/2...
Chage [Option] [username] # managing passwords
-L view user password settings
-M: minimum number of days for password Modification
-Maximum number of days for M password Modification
-D Date of last password Modification
-I. the number of days the account is locked after the password expires
-E: Set the password expiration date. If it is 0, the password will expire immediately. If it is-1, the password will never expire.
-W: set the number of days before the password expires.
User Group Management commands
Add User Group:
Groupadd name
Groupadd-g 888 webadmin # create a user group webadmin whose GID is 888
Delete user group:
Groupdel [group name]
Modify user group information:
Groupmod-n
Groupmod-n apache webadmin # modify the name of the webadmin group to apache
Expansion command:
Group
Newgrp switching User Group
Grpck user group configuration file detection, similar to pwck usage and Significance
Chgrp modify the group to which the file belongs
Edit the/etc/group file in vigr and lock the file during editing.
Manually delete a user
Use the find command to find files belonging to a user or user group:-user,-uid,-group,-gid
For example, find/home-user test
1. Move and back up files to be retained
2. Delete unnecessary files
3. Clear related table items in the User File
4. Clear the user's home directory
Expansion-
[Enable/disable the shadow function]
Pwconv/pwunconv
Kgconv/grpunconv
[Authconfig]
Linux provides more powerful tools to change many settings
Permanently valid. edit/etc/sysconfig/authconfig.
[Use graphical tools for management]
System-config-[Tab] [Tab]
System-config-users # Set users