Linux command: Useradd

Source: Internet
Author: User

Useradd Introduction to Commands:

The Useradd command is used to create a user, which is only available to the system Superuser root by default.

1 . command format: useradd [options] Username

Useradd [-C comment] [-D Home_dir]

[-E Expire_date] [-F Inactive_time]

[-G Initial_group] [-G group[,...]]

[-M [-K Skeleton_dir] |-m] [-s Shell]

[-U uid [-O]] [-N] [-R] Login

2. Command function:

account to create or update new user information

3 . Command parameters:

-u uid Specifies the UID of the new user (user ID number)

- G GID (Basic Group) specifies the base group GID (group ID number) for the new user

- g GID,... (Additional group) specifies the new user additional group GID (additional group ID number) Multiple attachment groups can be used, separated by

- C "COMMENT" This option is used to specify the user's description information for easy Administrator Management

-d/path/to/directory Specify a new user's home directory

- s SHELL This option is used to specify the user's shell, which is specified by default if the option is not used/bin/bash

- M - K When creating a new user, copy the configuration document in/etc/skel to the new user's home directory.

-M does not create a home directory when adding new users.

-R Add System user

4 . Command instance:

1. Useradd John add John User

[Email protected] test1]# Useradd John

[[email protected] test1]# passwd John set John user password

Change the user John's password.

New Password:

Re-enter the new password:

PASSWD: All the authentication tokens have been successfully updated.  

[Email protected] test1]# TAIL-N3/ETC/PASSWD

Oprofile:x:16:16:special user account to being used by Oprofile:/home/oprofile:/sbin/nologin

Donggen:x:500:500::/home/donggen:/bin/bash

John:x:501:501::/home/john:/bin/bash user does not specify Uid,gid, and basic groups and attachment groups, default options

2, useradd-u 666-g 500-g 500-c "Test User Management Command user" Tom

[[email protected] test1]# useradd-u 666-g 500-c "Testing User management Commands" Tom

[Email protected] test1]# TAIL-N3/ETC/PASSWD

Donggen:x:500:500::/home/donggen:/bin/bash

John:x:501:501::/home/john:/bin/bash

tom:x:666:500: User to test user administration commands:/home/tom:/bin/bash

[Email protected] test1]# Tail-n3/etc/gshadow

Donggen:!::tom This shows Tom User's attachment group as Donggen

john:!::

tom:!::



This article is from the "Learn Linux history" blog, please be sure to keep this source http://woyaoxuelinux.blog.51cto.com/5663865/1860967

Linux command: Useradd

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.