Linux useradd command details how to use Linux useradd command

Source: Internet
Author: User

Useradd can be used to create a user account. After the account is created, use passwd to set the password of the account, and use userdel to delete the account. The account created using the useradd command is actually saved in the/etc/passwd text file.

Syntax

Useradd [-mMnr] [-c <remarks>] [-d <logon Directory>] [-e <validity period>] [-f <buffer days>] [-g <group>]

[-G <GROUP>] [-s <shell>] [-u <uid>] [user account]

Or

Useradd-D [-B] [-e <validity period>] [-f <buffer days>] [-g <GROUP>] [-G <GROUP>] [-s <shell>]

Parameter description:

  • -C <remarks> add remarks. The remarks are saved in the remarks field of passwd.
  • -D <logon Directory> specifies the start directory for user login.
  • -D. Change the default value.
  • -E <validity period> specifies the validity period of the account.
  • -F <buffer days> specifies the number of days after the password expires.
  • -G <GROUP> specifies the group to which the user belongs.
  • -G <GROUP> specifies the additional group to which the user belongs.
  • -M automatically creates the 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 <shell> specifies the shell used after the user logs on.
  • -U <uid> specifies the user ID.

Instance

Add normal user

# Useradd tt

Specify the corresponding user group for the added user

# Useradd-g root tt

Create a system user

# Useradd-r tt

Specify the home directory for the newly added user

# Useradd-d/home/myd tt

Create a user and specify the ID

# Useradd caow.u 544

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.