When adding users, which files will be modified?
- /etc/passwd stores user information
- /etc/group stores user group information
- /etc/shadow store user password
- /etc/gshadow store user group password
The default configuration file when adding new users: / etc/default/useradd; only root can view and modify it
[root@localhost ~]# cat /etc/default/useradd
# useradd defaults file
GROUP=100 #It depends on the configuration of Usergroups ﹣ enab in / etc/login.defs. If it is no, it is empty here
HOME=/home #User home directory location
INACTIVE=-1 #Do you want to enable account expiration and suspension? - 1 is not enabled
EXPIRE= #Account end date, null value is not enabled
SHELL=/bin/bash #Default shell
SKEL=/etc/skel #Home directory default template
CREATE_MAIL_SPOOL=yes #Create user mailbox or not
New user's home directory template / etc/skel/
[root@localhost ~]# ls /etc/skel/ -al
total 20
drwxr-xr-x. 2 root root 4096 Jun 9 16:51 .
drwxr-xr-x. 79 root root 4096 Jul 6 19:04 ..
-rw-r--r--. 1 root root 18 Mar 23 08:15 .bash_logout
-rw-r--r--. 1 root root 176 Mar 23 08:15 .bash_profile #environment variable
-rw-r--r--. 1 root root 124 Mar 23 08:15 .bashrc #alias
Case - the command line prompt is: - bash-4.1$
Reason:
Use rm command to delete. Bash? Profile and. bashrc in zzz home directory by mistake
Phenomenon:
[root@localhost ~]# su - zzz
-bash-4.1$
Solution:
Copying files from a home directory template
-bash-4.1$ cp /etc/skel/.bash* ~
-bash-4.1$ logout
[root@localhost ~]# su - zzz
[zzz@localhost ~]$
Note: make sure the copied path is accurate to take effect!
Specify new user password rule / etc/login.defs
[root@localhost ~]# egrep -v '^#|^$' /etc/login.defs
MAIL_DIR /var/spool/mail
PASS_MAX_DAYS 99999 #Maximum password life
PASS_MIN_DAYS 0 #Minimum password life (change cycle)
PASS_MIN_LEN 5 #Minimum password length
PASS_WARN_AGE 7 #Warning days in advance of password failure
UID_MIN 1000
UID_MAX 60000
SYS_UID_MIN 201
SYS_UID_MAX 999
GID_MIN 1000
GID_MAX 60000
SYS_GID_MIN 201
SYS_GID_MAX 999
CREATE_HOME yes
UMASK 077 #Default permission mask
USERGROUPS_ENAB yes
ENCRYPT_METHOD SHA512