User management documents
the user's home directory
ordinary users: / home / username /, owner and group are user permissions are 700
super user: / root /, and their respective owners are the main root, permissions are 550
User's mailbox
/ var / spool / mail / username /
User Template directory
/ etc / skel
User Management Command -useradd
useradd [options] user name
-u UID: UID numbers manually specified user
-d home directory: manually specify the user's home directory
-c user Description: specifies the user's manual Description
-g Group name: Specifies the user manual the initial group
-G group name: additional specified set of users
-s shell: manually specify the user's login shell. The default is / bin / bash
add a default user
useradd HZY (useradd perform the following operations)
grep HZY / etc / the passwd
grep HZY / etc / Shadow
grep HZY / etc / Group
grep HZY / etc / Shadow
LL -d / Home / LAMP
LL / var / spool / mail / lamp
user defaults
/ etc / default / the useradd
the gROUP = 100 user default group
hOME = / home user home
INACTIVE password expiration grace (Shadow file 7 fields) days
eXPIRE = password expiration time (. 8)
the SHELL = / bin / bash the default shell
SKEL = / etc / skel template directory
CREATE_MAIL_SPOOL = yes establish whether the mailbox
/etc/login.defs
PASS_MAX_DAYS 99999 password is valid (5)
PASS_MIN_DAYS 0 password change interval (4)
PASS_MIN_LEN 5 minimum password 5 (PAM)
PASS_WARN_AGE 7 password expiration warning (. 6)
GID_MIN UID minimum and maximum range 500
GID_MAX 60000
ENCRYPT_METHOD the SHA512 encryption mode
User Management Command -passwd
passwd [options] username
password status -S queries the user's password. Only the root user can
-l temporarily locked users. Only the root user can
-u unlock the user. Only root users can
--stdin by the pipe symbol data outputted as a user's password
See the root password -S state the passwd
the root the PS 2019-08-05 99999 0 -1. 7 (set password, encryption using SHA512.)
(User password setting time (2019-08-05) password change interval (0) Password Validity (99999) warning time (7) password does not fail (-1))
Lock and unlock user users (the password in the shadow of the comments)
passwd the -l hanzhiyu
passwd -u hanzhiyu
User management and chage command usermod
modify user information usermod
usermod [options] user name
-u UID modify user UID number
-c user modify a user's information explaining
additional group -G group name modify the user's
-L temporarily locked users (Lock)
- U user to unlock locked (unlock)
Change the user password state the chage
the chage [options] user name
-l set out in detail the state of the user's password
-d date to change the password last change date (shadow3 field)
-m twice the number of days the password change interval (field 4)
-M the number of days the password is valid (5 fields)
-W days warning before password expiration days (6 fields)
the -I grace days the number of days after a password (field 7)
-E date account expiration time (8 fields)
Su command and user management userdel
Delete user userdel
userdel [-r] username
-r delete a user's home directory and delete users
view the user the above mentioned id
the above mentioned id [user name]
User Switching command su
su [options] username
- only option - switched together represent even the user's environment variables
-c command to execute a command only once without switching user identity