Linux User Management

Source: Internet
Author: User

User account Management:

User account management, add, delete, modify

User Password Management

User Group Management


First, user account management

1. Add User, Useradd

#useradd option User Name

-C Comment Specifies a descriptive description of the annotation

-D directory, specify the home directory, if this directory does not exist, and use the-M option, you can create a master directory at the same time

-G user group, specifying user groups to which users belong

-G user group, specifying additional groups to which the user belongs

-s shell file, specifying the user's login shell

-u user number, specify the user number, and if you have the-o option, you can re-use the other user's identification number


Example:

#useradd-D/home/jason-m Jason

Add a user jason,-d and-m option for user Jason to generate the home directory/home/jason

#useradd-S/bin/sh-g group-g jason,root Jason01

Create a Jason01 user, the login shell is/bin/sh, belongs to group user groups, but also belongs to the Jason and root user group, where group is the primary group


When creating, deleting users,/etc/passwd and/etc/shadow two files will have corresponding user record changes


2. Delete Account

#userdel option User Name

-R to delete the home directory created by the user


Example:

#userdel-R Jason removes Jason users (records in/etc/passwd and shadow files) while deleting user home directories


3. Modify your Account

#usermod option User Name

-C,-D,-M,-G,-G,-S,-u, and-O, these options are the same as in Useradd. Other than that:

-L modified to new user name


Example:

#usermod-L JASON01 Jason changes Jason login username to Jason01

#usermod-S/bin/ksh-d/home/jason01-g developer Jason01

The Jason01 user login shell changed to Ksh, user home directory changed to/home/jason01, user group changed to developer


Second, user password management

The root user can modify the login password of all users, and the normal user specifies to modify their login password.


#passwd option User Name

-l lock password, that is, disable the account

-U password unlock

-D make Account no password

-F forcing users to change their passwords the next time they log on


Example:

If the current user is Jason, the current user password is modified by default

#passwd

Old Password:

New Passwort:

Re-enter new password:

If the root user, the default is to modify the root user password, but can modify the specified user password:

#passwd Jason01 Root user to modify the specified user password, do not need to know the original password

New Passwort:

Re-enter new password:


#passwd-D jason01 Delete the Jason01 user password and do not need to enter the password the next time you log in

#passwd-L JASON01 lock Jason01 user so that they cannot log on


User group management: slightly



Linux User 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.