Usage of the useradd command in Linux

Source: Internet
Author: User

The following content is reproduced from http://www.cppblog.com/prayer/archive/2009/08/13/93234.html

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 Parameters
-C: add the remarks text. The remarks text is saved 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: Specifies 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 the creation of 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 should be noted that when setting the id value, try to be greater than 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 this directory does not exist, you can use the-M option to create a 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.
 The-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.
Through the above explanation, we can clearly understand the specific meaning of the above command,
Create a new Oracle user, which initially belongs to 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.