20150825-User, user group management

Source: Internet
Author: User

1. Create user and parameter description

Usage:

Useradd (option) (parameter)

Parameters:

-D: Specify home directory when creating user

-D: Modify the default value when creating a user

-e: Specify the expiration date of the account

-F: Specifies how long a user's password can be used after it expires

-G: Specify the group to which the user belongs

-G: Specify additional groups to which the user belongs

-M: Create User home Directory

-M: Do not create user home directory

-r: Create System account (1-499 or 1-999)

-S: Specifies the shell that is used after the user logs on

-u: Specify user uid


2, modify the user

Usage:

Usermod (option) (parameter)

Parameters:

-D: Specify home directory when creating user

-e: Specify the expiration date of the account

-F: Specifies how long a user's password can be used after it expires

-G: Specify the group to which the user belongs

-G: Specify additional groups to which the user belongs

-S: Specifies the shell that is used after the user logs on

-L: Modify user Name

-L: Lock user

-U: Unlocked


3. Delete users

Usage:

Userdel (option) (parameter)

Parameters:

-F: Force delete

-R: Delete the user and delete the associated files at the same time



4. Create user group and parameter description

Usage:

Groupadd (option) (parameter)

Parameters:

-G: Specify GID for new group

-r: Create a system group (ID between 1-499 1-999)

-O: Allow group to add ID not unique


5, modify the group data

Usage:

Groupmod (option) (parameter)


6. Common examples

3.1, build a user chinamobile, specify the user ID is 10086, use the existing/home/test directory as home directory, do not create a new home directory, the user is valid for 365 days, the default user group is Chinamobile, Additional user group is chinanet (user group already exists)

Useradd chinamobile-u 10086-m-d/home/test-e 365-g chinanet


3.2, create user group CNC, and add user chinamobile to this user group

Groupadd CNC

Usermod-a-G CNC chinamobile


3.3, forcibly delete user deltest, and associated files

Userdel-f-R Deltest


3.4, modify the group name CNC for Wangtong

Groupmod-n Wangtong CNC

20150825-User, user group management

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.