Big Data and cloud computing (Wang Minglong) instructor-linux-day01-User Management

Source: Internet
Author: User

User Management

A Must know Point
1. User Information file/etc/passwd
2. User name: Password: uid:gid: Description Information: Home directory: Login status
3. User Password storage file/etc/shadow
4. Every time a new account is created, a home directory with the same name as the username will be generated in the home directory


Two Add an Account

Useradd The name of the "parameters" account

-U Specify UID usage for User: useradd-u UID Number user name
-G Specify the user's primary group usage: USERADD-G Group name User name
-G Specify user's attached group usage: USERADD-G Group name User name
-D Specify the user's home directory usage: useradd-d/directory name User name
-s Specifies that the system cannot be logged on user usage: useradd-s/sbin/nologin user Name


Three Switch users

SU user name only switches users, not fully logged inSu-user name fully logged into userExit Log out of your current account

Add an account manually (to speak)

Four Modify your account (you can directly modify the passwd file)

Usermod–helpusermod-l new name Old name//modify user nameusermod-u New ID User name//modify User ID numberusermod-u New Id-o username//Add an already existing UIDusermod-g new GID username//Modify user's group ID numberusermod-c Account Description User name//Add descriptive information to the userusermod-d Home directory path user name//modify user home directoryusermod-s New Shell username//Modify user's shell, also known as Modify user's login statususermod-s/sbin/nologin username//Modify user cannot login systemusermod-g Group name User name//modify user's attached groupusermod-l User name//lock userusermod-u user name//unlock user

See which shells are now supported by the system:

Cat/etc/shells

Five Delete Account

userdel-r User name/delete user at the same time delete personal informationUserdel User name//delete User only

Six Account password Settings password: Normal account can not set their own initial password, can only modify

passwd//Modify the current login account passwordpasswd User name//modify the password of the specified user

Seven Lock password//only root can operate

passwd-l account name//Lock account passwordpasswd-u account name//Unlock account passwordpasswd-s Account name//view user status

User Group Management


A Must know Point
1. User group information file/etc/group Group name: Representative Group Password: GID: Team member
2. User group password storage site/etc/gshadow Group name: encryption Password: Group Administrator: Team members


Two Add Group

Groupadd Group name//Add group, GID system automatic assignmentgroupadd-g GID Group name//modify group IDgroupadd-g gid-o Group name//Plus-o parameter, can add n GID same group


Three Modify Group

groupmod-n New group name old group name/modify Group namegroupmod-g GID Group name/modify GIDgroupmod-g gid-o Group name//Plus-o parameter, can be modified to a group of n GID same


Four Delete a group

Groupdel Group name


Five Group password

GPASSWD Group name


Six Add and remove members

gpasswd-a account name Group name//Add team membergpasswd-d account name Group name//delete team member

Seven Add Group Admins

gpasswd-a User name Group name


Eight Modify file attached Group

CHGRP Group name file name key content

Big Data and cloud computing (Wang Minglong) instructor-linux-day01-User Management

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.