1 how users exist with the system
/etc/passwd # Use information files
User name: User password: User uid : User gid: User description: User home directory: User-used Shell
/etc/shadow # user authentication information
User name: Password: Password Last modified date: Minimum validity: Password maximum validity: password warning period: Password inactive period: Password expiration Date:
/etc/group # User group Information
User group name: User Group password: User group ID: Additional user member
Initial group:
Additional groups: User-attached groups
/home/username # User home directory
/etc/skel/.* # Basic information configuration for users
Text Create new user is copy This file to user home directory
2. User Action Commands
ID View user Information
ID - u # # user uid
- G # # user gid
-A # # users All information
- G # # # users are all IDs
-un # # user name
-GN # # user Initial group name
-GN # # # users All group names
Su-username # # # Toggles the environment used by user users
Echo $PATH # # # View the user environment for the current user
Echo $USER # # # Displays information about the current user
3. Useradd # # # New user
- u # # # Specify uid for user
- G # # # Specify user initial group, this group must exist
- G # # # Specifies additional groups, and groups also exist
- C # # User Description
- D # # # Specify user plus directory
- S # # # Specify the shellThe user uses,shell type See /
Etc/shells Shell Type
4./etc/login.defs Default configuration when creating a user
Userdel - R # # # Delete users
Groupadd - G # # # New Group,-g indicates the ID of the specified group
Groupdel # # # Delete Group
passwd # # # change user password
5. view the commands used by the user to establish or manage the process
Watch-n 1 ' tail-3/etc/passwd;echo @@@@@@@@@@@@@@@@@@@@@@@@@@;tail-3/etc/group '
6. Usermod-u# # change user uid
- G # # change user initial group
- G # # change user-attached groups
-G "" # # Cancel all user groups
-ag # # Add user additional groups
- D # # change user home directory information
-MD # # change user home directory information and home directory name
- S # # change user's shell/sbin/nologin System user, not login
# # change user's description
- L # # freeze users
- u # # unlock users
Passwd-l Freezing user strength stronger
7. Devolution of user authority (sudo command Authority)
Configuration file for permission devolution action
/etc/sudoers
This file is edited with the visudo command ( directly with the command )
File contents
authorized target user host name =(new user identity granted to authorized users) authorizing users to execute commands
Test localhost=(root) Nopasswd:/usr/sbin/useradd
call with sudo
8. Password Age Change
User name: Password: Password Last modified date: Minimum validity: Password maximum validity: password warning period: Password inactive period: Password expiration Date:
chage - D 0 # # How long The secret is used, how to set it to 0 indicates that the user must change the password before logging on to the system
- M # # minimum validity
- M # # Maximum validity
- W # # warning period
- I. # # non-active period
- e # # expiry time format yyyy-mm-dd
User and Group Management