linux-Fifth Lesson Note-[user and user group actions]

Source: Internet
Author: User
Tags stdin

User and Group Management commands

Useradd: Used to create a new user

Format: useradd [options] User name

-D Specify the user's home directory

-D Show default values

-e account expiration date, format: Yyyy-mm-dd.

-G Specify an initial user group (must already exist)

-g specifies one or more extended user groups

-N does not create a user group with the same name as the user

-s Specifies the default shell

-U specify UID for user

Instance:

[Email protected] ~]# useradd-d/home/linuxs-u 8888-s/sbin/nologin Linuxs

To view basic information about a user:

[[email protected] ~]# ID Linuxs

uid=8888 (Linuxs) gid=8888 (LINUXS) group =8888 (LINUXS)

passwd: Used to modify the user's password

Format: passwd [options] User name

-l lock User against login

                   -u               unlock to allow users to log on to

                   --stdin       allows user passwords to be modified from standard input, such as (echo "123.com" | passwd--stdin                                                                                                                        Username)

-D make Account no password

-E force user to change password at next logon

-S Displays the user's password status

Instance:

Userdel: Used to delete all user tables

Format: Userdel [options] User name

-F Force removal of users, home directories and their associated files

-R Delete users, home directories and their associated files at the same time

Instance:

[Email protected] ~]# Userdel-r Linuxs

[[email protected] ~]# ID Linuxs

Id:linuxs: No such user

Usermod: Used to modify a user's properties

Format: usermod [options] User name

-C fill in the Account note information

-d-m-M with-D allows you to reassign the user's home directory and automatically transfer the old data to the new home directory

-e account expiry time, format "YYYY-MM-DD"

-G Change the owning user group

-G Change Extended user group

-L lock users against their login system

-U unlocks the user and allows it to log on to the system

-S Change the default terminal

-U modify UID of user

Instance:

[Email protected] ~]# usermod-m-d/home/linuxx linuxs #指定新家目录

[Email protected] ~]# ls/home/

Linuxx

[Email protected] ~]# usermod-u 6666 Linuxs

[[email protected] ~]# ID Linuxs

uid=6666 (Linuxs) gid=8888 (LINUXS) group =8888 (LINUXS)

Groupadd: for creating groups

Format: groupadd [options] Group name

Instance:

[Email protected] ~]# Groupadd Superbsd

Groupdel: Used to delete a group

Format: Groupdel [options] Group name

Instance:

[Email protected]~] #groupdel Superbsd

linux-Fifth Lesson Note-[user and user group actions]

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.