The "Linux" foundation of daily life Useradd&groupadd

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.