Linux User Management

Source: Internet
Author: User

1: System User files

/ETC/PASSWD is used to save the file of the system user's user settings. To view the contents of a system User file:

cat/etc/passwd

2: View user password file

The file used to save the user's password is/etc/shadow, because Shadow is also a shadow, so someone calls it a shadow file and looks at the contents of the shadow file:

Cat/etc/shadow

3: Add user command

useradd [option] Tannengcai (Create a user with an account named Tannengcai)

The common options (option) are:

G: Specify the user group for the new user Useradd-g Group user (group with the Users group for the new user added using the option specified)

S: Specifies the shell used by the new user; Useradd-s/bin/ksh User (the default shell for user added with options specified is/bin/ksh)

4: Set User password command

When adding a user must remember to set the user password, or others can not login (no settings, password is messy)

passwd User (set user's password command)

5: Delete User command

Userdel [option] Username

The common option [option] is only r, and the function of this option is to delete the user in conjunction with the user's home directory and mail files, such as:

Userdel-r Tannengcai

If you forget to add the option r when deleting the user, you can only delete the user information, the user's home directory and mail files will also be retained, if you want to delete again, please use:

rm-rf/home/tannengcai/

6: User Management commands

usermod [option] Username

Common options [option] are:

L: Lock users, that is, prevent users from logging into the system

U: Unlock

E: Specify user Expiration Time

F: Refers to the buffer time after the user expires, that is, the number of days to log in after expiration

D: Specify a new home directory for the user

M: To specify a new home directory for users, move all files in the original home directory

S: Modify the user's default shell

Usage examples:

USER-L username;

User-u username;

USER-E username;

USER-F username;

user-d/file/user/home/user username;

user-d/file/user/home/user username-m username;

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.