How to use CentOS under Useradd,groupadd, etc.

Source: Internet
Author: User


Learn about the Linux user and group management commands below.


Useradd : Useradd-create A new user or update default new user information

Use format: useradd [options] LOGIN

- u : The UID is followed by the specified user UID.

- G : The GID is followed by the specified user's valid group.

- G : The next group name is the additional group that the account can join.

- M : Mandatory! Do not create user home directory! (Default value for System account).

- M : Mandatory! To create a user home directory! (The default value of the general account).

- D : Specifies that a directory becomes a home directory without using default values. Be sure to use absolute paths!

- R : Set up a System account, the UID of this account will be limited (refer to/etc/login.defs)

- S : followed by a shell, default is/bin/bash if not specified

Related File information:

User account password parameters of the file:/etc/passwd,/etc/shadow

Profiles related to user groups:/etc/group,/etc/gshadow

Passwd: passwd-update user ' s authentication tokens

Use format: passwd [options] ... Name

- L: Lock This account

- u: unlock This account

--stdin: use the data from the previous pipeline as input to the password

Relevant file information:/ETC/PAM.D/PASSWD

Chage : Hage-change User password expiry information

Use format: chage [options] [LOGIN]

- D 0: indicates that the user must change the password to enter the system when logging in.

Usermod : usermod-modify a user account

Use format: usermod [options] LOGIN

- D: after the user's home directory, modify the user home directory

- G: next to the user's valid group, modify the active group

- G: next to the user's additional group, modify the additional group

- L: after the user's account name, modify the user name

- S: Modify Shell

- u: Modify UID

- L: Lock the user

- u: Unlock


Userdel : Userdel-delete A user account and related files

Use format: Userdel [options] LOGIN

- R: deleted along with user home directory

CHFN: Chfn-change your finger information

use format: CHFN [option] ... username

- F : followed by the full name

- o : Your office room number

- P : The telephone number of the Office

- H : The home phone number

CHCH: Change Shell

Use format: CHCH [option]...username

- L: list system available shells

- S: Modify Shell

Groupadd: groupadd-create a new group

Use format: groupadd [options] Group

- G: Specify the group ID

- R: set up system groups

Groupmod : groupmod-modify A group definition on the system

Use format: groupmod [options] GROUP

- G: Modify GID

- N: Modify Group name

Groupdel : Groupdel-delete a group

Use format: Groupdel Group

gpasswd: Gpasswd-administer/etc/group And/etc/gshadow

Use format: gpasswd [option] Group

    : no parameters, indicating a password for the group

-A: Specify the group administrator

-M: Add an account to this group

- R: Removing a group password

- R: to invalidate a group's password bar

# use format for Group admins:

-A : join a user to a group

- D: remove a group from a user




How to use CentOS under Useradd,groupadd, etc.

Related Article

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.