Linux adduser command details how to use the Linux adduser command

Source: Internet
Author: User

The adduser and useradd commands are the same commands (symbolic link is connected by symbols ).

Permission: system administrator.

Adduser is used to add users. In contrast, you can also delete user commands, userdel. Syntax: userdel [login ID]

Syntax

Adduser [-c comment] [-d home_dir] [-e expire_date] [-f inactive_time] [-g initial_group]

[-G group [,...] [-m [-k skeleton_dir] |-M] [-p passwd] [-s shell] [-u uid [-o] [-n] [-r] loginid

Or

Adduser-D [-g default_group] [-B default_home] [-f default_inactive]

[-E default_expire_date] [-s default_shell]

Parameter description:

  • -C comment: annotation data of the new user in the password file (usually/etc/passwd)
  • -D home_dir: Set the user's home directory to home_dir, and add the user account loginid after the preset home value.
  • -E expire_date sets the validity period of this account (in the format of YYYY-MM-DD), default value is permanently valid
  • -F inactive_time example:

Instance

Add a common user

# Useradd kk // add user kk

Specify the corresponding user group for the added user

# Useradd? G root kk // add user kk and specify the user group as the root user group

Create a system user

# Useradd? R kk // create a system user kk

Specify the/home directory for the newly added user

# Useradd-d/home/myf kk // add user kk, whose home directory is/home/myf

// When the user name kk logs on to the host, the default directory entered by the system is/home/myf

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.