First, the user account management
1, the user account classification
Super User: root uid = 0 gid = 0 authority largest,
Average user: uid> = 1000 limited authority
User program: 1 <= uid <1000 can not be used or log management system
2、/etc/passwd
Meaning a total of seven fields, each field
The first field: user account name
The second field: password placeholder
The third field: uid number
Fourth field: gid number
The fifth field: empty. User comments
Sixth field: a user's home directory
Seventh field: login shell
3、/etc/shadow
The first field: user account name
The second field: ciphertext
The third field: the account was last modified time from January 1, 1970 the number of days past
Fourth field: the number of days since the last password from the password can not be changed again modified
The fifth field: password expiration days
Sixth field: the number of days to force password change reminder
Seventh field: Empty
The eighth field: Empty
Ninth field: empty, no
4, useradd: add user accounts
Format: useradd + Option + username
Options: -u uid designated tag number
-d specifies the home directory
-e account designated expiry time
-M does not create the home directory for the user to initialize
-s Specifies the user login shell
-g Specifies the user's basic group name
-G specify additional user group name
-c add notes, displayed in the / etc / passwd fifth field
5, the initial user account profiles
File Source: / etc / skel in
Profiles:
(1)/.bash_profile
(2)/.bashrc
(3)/.bash_logout
Additional: (1) cd ~ + Username: the user's home directory to
(2) cd ~: the currently logged-on user
6, echo: echo command
Format: echo "what is displayed."
Vi editor input
7, passwd: change user password settings
Format: passwd + Option + username
Options: -d clear the user password
-l Lock user accounts
-s View user's account status
-u unlock user accounts
-x maximum password expiration period
-n minimum password expiration period
-w number of days before the password expires began to remind users
-i When the password expires after the number of days the account is disabled
8, usermod: Modify User Attributes
Format: usermod + Option + username
Options: -l Change the user account's login name
-c modify user comments
-L Lock user accounts
-U Unlock a user account
-u uid designated tag number
-d specifies the home directory
-e account designated expiry time
-s Specifies the user login shell
-c add notes, displayed in the / etc / passwd fifth field
9, userdel: Delete user accounts
Format: userdel + username
Options: -r delete users delete the user's home directory
Second, group account management
Basic groups, additional groups
1, group accounts file: / etc / group
2, groupadd: Add group accounts
Format: groupadd [-g GID number] group account name
Options: -g GID number (such as 888)
3, gpasswd: add and delete group members (set group account password)
Format: gpasswd + Option + group account name
Options: -a Add a user to the group
-d delete a user from a member of the group
-M-defined list of group members, separated by commas
Note: Adding delete group members can also use the vi editor, vim / etc / group
4, groupdel: delete group accounts
Format: groupdel + group account name
Third, the query command
1, id: query user identity
Format: id + username
2, groups: group of customers belongs inquiry
Format: groups + username
3, finger (need to install: yum -y install finger): query account details
Format: finger + username
4, w: Query logged-in user information to the host
5, whoami: query account name currently logged
6, who: query the user has logged on to the host information