Notes on Linux private food for laruence (13) -- User Management

Source: Internet
Author: User
1. check the user identity the user can use the following command to understand the user identity who: query the current online user groups: query the user's group id: display the current user information finger: query User Information 2. Add user instructions add command useradd & lt; u

1. check user identity

You can use the following commands to learn about your identity.

Who: query current online users

Groups: query the user group

Id: displays the current user information

Finger: query user information

2. add a user

Add command with command

Useradd

Passwd

Standard steps for adding users to the system

Edit/etc/passwd and/etc/group

Create User main directory

Copy files and directories from/etc/skel

Allow new users to gain ownership of their home directories and files

A new user password

3. change/delete a user

1. you can change user information through:

Redhat-config-users or kusers

On the character interface, you can use the usermod command to change

Important parameter:-c-d-e-G-g-S-u-p-L

Set user password expiration

2. the system administrator can use the userdel command to delete existing users.

The parameter-r can help the system delete a user's directory.

4./etc/passwd file

The passwd file records user logon information.

Each row represents a user. it is divided into seven items, that is, the user's basic logon information.

Add or delete a user. the most basic operation is to add or delete a personal record in the passwd file.

Login name: logon user name (for example, root)

Passwd: password (for security in another file)

Uid: User ID (if the uid is 0, it is the system administrator, 1-99 is reserved for the system as the default account, and uid> = 500 is the general account)

Gid: ID of the default logon group (/etc/group)

Full name: User's full name or comment

Hom directory: user's main directory

Shell: shell is used by default.

V. Home directory

The create home option in login. defs determines whether the system creates the home directory when creating a user.

When you create a user's home directory, the system copies the content in/etc/skel to the new directory.

Finally, the system will make the directory and its files belong to the new user.

Chown-R user. group directory name

6./etc/shadow

Currently, Rad Hat Linux stores the user password in the/etc/shadow file by default.

The default permission for passwd files is 644, and that for shadow files is 400.

The shadow file supports password expiration settings.

Each row in the shadow file represents the password record of a system user, separated by a number.

You can use authconfig to set whether to use shadow and md5 encryption.

Shadow file details

Logon user name

User password (usually encrypted by md5)

From January 1, January 1, 1970 to the last time the password was changed

The password can be changed in a few days (0 indicates that the password can be changed at any time)

The password must be changed in a few days (99999 means it will never expire)

The account will be canceled several days after the password expires

The number of days after which the account expires from January 1, January 1, 1970

VII. group management

Group information in the system, recorded in/etc/group

The system user can directly modify the/etc/group file to reorganize the data, or use the following command

Groupadd: add a group

Groupdel: deletes an existing group.

Groupmod: information for restructuring

You can use the newgrp command to change the current group.

8. group files

Each row in/etc/group represents a group. separate different items:

Group_name: group name

Passwd: group password (generally not used)

GID: group ID

User_list: group member list

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.