With Margo Linux (Lesson 1)

Source: Internet
Author: User

Summary of simple User management commands

One, user-related commands

1.useradd

Man Document Description: Create a new user or update default new user information

英文说明: Create a new user or update the default new user information

Reusing parameters:

-D,--home home_dir: Create home directory

-C,--comment comment Create comment description

-D,--defaults modify the user default value parameter

-G,--gid Group specifies basic groups

-G,--groups group1[,group2,... [, GROUPN]] Specify a secondary group, multiple groups can be separated by commas to add

-S,--shell shell specifies the default shell

-U,--uid uid Specify user uid

Example: Create a new user Tom Comment is: Tomcat, additional group is cat, default shell is/sbin/nologin

Groupadd Cat; Useradd-c "Tomcat"-G cat-s/sbin/nologin Tom


2.userdel

Man Document Description: Delete a user account and related files

英文说明: Delete user account and related files

Important Parameters:

-F,--force forcibly delete the user, even if the user is still logged in

-R,--remove delete users and their home directories and mail buffer pools

Example: Delete a Tom and its related files

Userdel-r Tom


3.usermod

Man Document Description: Modify a user account

英文说明: Modify a currently existing account, the basic parameters and Useradd are consistent

Important Parameters:

-A,--append is used with the-G parameter to add a user to multiple additional groups

-L,--lock lock an account

-u,--unlock Unlocking an account

Example: Modifying a Tom User's shell to/bin/bash and adding it to the dog group

Usermod-a-G dog-s/bin/bash Tom


Second, the group of related orders

1.groupadd

Man Document Description: Create a new group

英文说明: Create a new group

Important Parameters:

-G,--gid GID specify group ID

-p,--password password specifying a group password allows users to join with the NEWGRP command

Example: Create a new group named Dog with a group password of dog123

Groupadd-p ' dog123 ' dog


2.groupdel

Man Description: Delete a group

英文说明: Delete a group

Example:

Groupdel Dog


3.groupmod

Man Description: Modify a group definition on the system

英文说明: Modify a group that already exists in a system

-G,--gid GID modified GID

-P,--password password modify group password

Example:

Modify the dog group password to dog456

Groupmod-p ' dog456 ' dog


Third, password modification

passwd

Man Description: Update user ' s authentication tokens

英文说明: Modify the user authentication token

Important Parameters:

-U Lock user

-L Unlock User

--stdin Modifying a user's password in a pipe format

Example: Modify a Tom user password by using the--stdin method

Echo ' AAABBBCCC ' |passwd--stdin Tom



With Margo Linux (Lesson 1)

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.