Useradd command for creating user accounts
Useradd can be used to create user accounts. After the account is built, then use passwd to set the password of the account. You can delete an account by using Userdel. The account number created by using the USERADD directive is actually saved in the/etc/passwd text file.
Parameter description:
-c< notes >: Add notes Text. Note text is saved in the remarks field of the passwd.
-d< Login Directory >: Specify the Start directory at which users log in.
-e: Specify the account validity period
-F: Specify how many days after the password expires to close the account
-G: Specifies the group to which the user belongs
-G: Specify an additional group to belong to
-M: Automatically set up user account login directory
-M: Do not automatically set up user account login directory
-N: Cancels the creation of a group named after the user name
-r: Create a System account
-S: Specifies the shell to use when the user logs on
-u: Specify user uid
Instance:
1. Add a general user
Useradd Li
2. Specify the appropriate user group for the added user
Useradd-g Root Li
3. Create a System user
Useradd-r Li
4. Specify the home directory for newly added users
Useradd-d/beshome/li
5. Create the user and set the ID
Useradd Li-u 501
The Groupadd command is used to create a new workgroup
Parameter description:
-G: Specifies the ID of the new workgroup
-r: Create system Workgroup, System Workgroup Group ID is less than 500
-K: Overwrite configuration file "/ect/login.defs"
-O: Allow workgroup to add group ID number not unique
Instance:
Create a new group and set the group ID to join the system:
Groupadd-g 344 Linuxde
The "Linux" foundation of daily life Useradd&groupadd