The useradd command usage in Linux is detailed

Source: Internet
Author: User
Tags dba

1. Role

The Useradd command is used to establish user accounts and create a user's starting directory, which is the ultimate user.

2. Format

The code is as follows:

Useradd [-D home] [-s Shell] [-c comment] [-m [k template]] [-f inactive] [e-expire] [-P passwd] [-R] Name

3. Main parameters

-C: Plus note text, note text saved in passwd's Notes bar.

-D: Specifies the starting directory for users to log in.

-D: Change preset values.

-e: Specifies the expiration date for the account, which is permanently valid by default.

-F: Specifies how many days after the password expires, the account is closed.

-G: Specifies the group to which the user belongs.

-G: Specifies the additional group to which the user belongs.

-M: Automatically create a user's login directory.

-M: Do not automatically create a user's login directory.

-N: Cancels the establishment of a group in the name of the user.

-R: Set up System account.

-S: Specifies the shell to use when the user is logged in.

-U: Specifies the user ID number.

4. Notes

Useradd can be used to create user accounts, he and AddUser commands are the same. After the account is built, then use passwd to set the password of the account. The account created using the Useradd command is actually saved in the/etc/passwd text file.

5. Application examples

Create a new user account and set the ID:

The code is as follows:

#useradd Caojh-u 544

It should be noted that the set ID value as much as possible to be greater than 500, so as not to conflict. Because Linux installation will create a number of special users, generally 0 to 499 of the value of the bin, mail, such as the system account.

Met today with such an order:

The code is as follows:

Useradd oracle-g oinstall-g dba

Feel very surprised, why the G and G these two parameters will exist at the same time?

Check the information on the Internet to learn that the main parameters used by the Useradd command are as follows:

-C Comment Specifies a section of an annotation description.

The-D directory specifies the home directory, which, if it does not exist, can be created using the-M option.

The-G user group specifies the user group to which the user belongs.

-G user group, where the user group specifies the additional group to which the user belongs.

-S Shell file specifies the user's login shell.

The-u user number specifies the user's user number, and if the-o option is available, the other user's identification number can be reused.

Through the above explanation, we can now clearly understand that the above command is specifically meant to

A new Oracle user is created, which is initially owned by the Oinstall group and also belongs to the DBA group.

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.