Useradd command details

Source: Internet
Author: User

1. Role
The useradd command is used to create a user account and create a user's initial directory. The permission is the ultimate user.
2. format
useradd [-D Home] [-s shell] [-C comment] [-M [-k template] [-F inactive] [-e expire] [-P passwd] [-R] Name
3. main Parameter
-C: add the remarks text, and save the remarks text in the remarks column of passwd.
-D: Specify the start directory when the user logs on.
-D: Change the default value.
-E: Specifies the validity period of the Account, which is permanently valid by default.
-F: specifies the number of days after the password expires.
-G: Specify the group to which the user belongs.
-G: Specify the additional group to which the user belongs.
-M: automatically creates a user's logon directory.
-M: do not automatically create a user's logon directory.
-N: Cancel creating a group named by the user name.
-R: Create a system account.
-S: Specifies the shell used after the user logs on.
-u: Specifies the user ID.
4. Description
useradd can be used to create a user account. It is the same as the adduser command. After the account is created, use passwd to set the account password. The account created using the useradd command is actually saved in the/etc/passwd text file.
5. application instance
Create a new user account and set the ID:
# useradd caow.u 544
it must be noted that, when setting the id value, try to exceed 500 to avoid conflict. After Linux is installed, some special users are created. Generally, the value between 0 and 499 is left to system accounts such as bin and mail.

today, I met a command like this:
useradd Oracle-G oinstall-g dba
I feel very surprised. Why does the two parameters g and G exist at the same time?
I checked the information on the Internet and learned that the main parameters used by the useradd command are as follows:
-C comment specifies an annotation description.
-d directory specifies the user's main directory. If the directory does not exist, use the-M option to create the main directory.
-G User Group specifies the user group to which the user belongs.
-G user group, which specifies the additional group to which the user belongs.
-s shell file specifies the user's logon shell.
-u user number specifies the user number of a user. If the-O option is available at the same time, the user ID of another user can be reused.
the above explanation clearly shows that the above command specifically means that
A New Oracle user is created, which initially belongs to the oinstall group, at the same time, let him also belong 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.