1. Create user and parameter description
Usage:
Useradd (option) (parameter)
Parameters:
-D: Specify home directory when creating user
-D: Modify the default value when creating a user
-e: Specify the expiration date of the account
-F: Specifies how long a user's password can be used after it expires
-G: Specify the group to which the user belongs
-G: Specify additional groups to which the user belongs
-M: Create User home Directory
-M: Do not create user home directory
-r: Create System account (1-499 or 1-999)
-S: Specifies the shell that is used after the user logs on
-u: Specify user uid
2, modify the user
Usage:
Usermod (option) (parameter)
Parameters:
-D: Specify home directory when creating user
-e: Specify the expiration date of the account
-F: Specifies how long a user's password can be used after it expires
-G: Specify the group to which the user belongs
-G: Specify additional groups to which the user belongs
-S: Specifies the shell that is used after the user logs on
-L: Modify user Name
-L: Lock user
-U: Unlocked
3. Delete users
Usage:
Userdel (option) (parameter)
Parameters:
-F: Force delete
-R: Delete the user and delete the associated files at the same time
4. Create user group and parameter description
Usage:
Groupadd (option) (parameter)
Parameters:
-G: Specify GID for new group
-r: Create a system group (ID between 1-499 1-999)
-O: Allow group to add ID not unique
5, modify the group data
Usage:
Groupmod (option) (parameter)
6. Common examples
3.1, build a user chinamobile, specify the user ID is 10086, use the existing/home/test directory as home directory, do not create a new home directory, the user is valid for 365 days, the default user group is Chinamobile, Additional user group is chinanet (user group already exists)
Useradd chinamobile-u 10086-m-d/home/test-e 365-g chinanet
3.2, create user group CNC, and add user chinamobile to this user group
Groupadd CNC
Usermod-a-G CNC chinamobile
3.3, forcibly delete user deltest, and associated files
Userdel-f-R Deltest
3.4, modify the group name CNC for Wangtong
Groupmod-n Wangtong CNC
20150825-User, user group management