How to manage CentOS accounts

  
                

As a Linux administrator, you need to manage the system account reasonably, including group creation, password setting, and authority management. Today, Xiaobian wants to introduce you to the management of CentOS accounts, and friends who don’t know how to manage them. Can come and learn.

Each file in Linux is divided into three types of permissions: the permissions of the account itself, the permissions of the group in which the account is located, and other permissions. Accounts and groups are many-to-many relationships, that is, one account can belong to multiple groups, and one group can contain multiple accounts. However, for each logged in account, there can only be one currently active group (initial group).

The account management related configuration files are as follows: account information file is /etc/passwd, account password file is /etc/shadow, group information file is /etc/group, group password file is /etc/gshadow .

1, /etc /passwd file to see how

as shown above, /etc /passwd file for each account a behavior, as colon of each field divided by mean number They are as follows:

[1] Account name. Renamed using the command usermod -l

[2] password, this field is enabled. The account password is configured in the /etc/shadow file

[3] UID, the unique identifier of the account. The commands that affect the value of this field include: useradd -u, usermod -u

[4] GID, the unique identifier of the initial group, associated with the third field of the /etc/group file. This group is the default valid group for the account (the active group can be switched using the newgrp command). The commands that affect the value of this field are: useradd -g, usermod -g

[5] Description. The commands that affect the value of this field include: useradd -c, usermod -c

[6] The absolute path to the home directory. The commands that affect the value of this field include: useradd -d, usermod -d

[7] shell, the shell that is enabled by default on the account. When it is /sbin/nologin, the account cannot be logged in. The shell that the account can use can be queried with the command chsh -l (the result of the query is the contents of the /etc/shells file). Effect of the command field value comprises: useradd -s, usermod -s

2, /etc /shadow file to see how each line

as shown above, the file /etc /shadow of Corresponding to the password information of an account, the meaning of each field with a colon as a segmentation is as follows:

[1] Account name, associated with the first field of the /etc/passwd file

[2] Password, encrypted ciphertext, the encryption algorithm is specified by ENCRYPT_METHOD in the /etc/login.defs file, here SHA512. Commands that affect the value of this field include: usermod -L (pre-!! freeze), usermod -U (defrox), passwd -l (freeze), passwd -u (defrox),

[3] Date, the above image shows a number indicating the number of days since 1970-01-01. The commands that affect the value of this field include: chage -d

[4] How many days after the password is created to be modified again, 0 means no such restriction. The commands that affect the value of this field include: passwd -n, chage -m

[5] How many days after the password is created expires, 99999 days is equal to 99999/365 years, and hundreds of years means the password will not expire. The commands that affect the value of this field include: passwd -x, chage -M

[6] How many days before the password expires, the warning message is sent to the user. The commands that affect the value of this field include: passwd -w, chage -W

[7] How many days can the password be extended after the password expires? During this time period, the user can also log in and change the password. After this time. Segment users will not be able to log in. Commands that affect the value of this field include: useradd -f, usermod -f, passwd -i, chage -I

[8] Expiration date, a number indicating that it has been experienced since 1970-01-01 The number of days. After this day, the user's password will be invalid, and you can't log in any time, whether it is expired or not. The commands that affect the value of this field include: useradd -e, usermod -e, chage -E

[9] Reserved
Previous123Next page Total 3 pages

Copyright © Windows knowledge All Rights Reserved