User and group related files, Useradd
1. User and group related files
(1)/etc/passwd
Format: Name:passwd:UID:GID:GECOS:directory:shell
Zhubiao:x:1000:1000:zhubiao:/home/zhubiao:/bin/bash
1 Name:user ' s login name
2 passwd:x occupied, actually deposited in/etc/shadow
3 uid:user ID, user code
The range of User IDs is determined by/etc/login.defs uid_min Uid_max [Uid_min,uid_max]
System account: 1-499, 1-999
General Account: 1000+,
4 gid:group ID, group code
The range of group IDs is determined by/etc/login.defs gid_min Gid_max [Gid_min,gid_max]
System groups: 1-499, 1-999
General Group: 1000+,
Group Category:
Basic group:
Private group: The group name and user name are the same, and only one user is included
Additional groups:
5 Gecos:comment filed, summary field
6 Direcotory:user ' s home directory, user home
Home directory default directory is determined by "home=/home" in/dev/default/passwd
The Add directory configuration file is determined by "Skel=/etc/skel" in/dev/default/passwd
7 Shell:set The shell environment variable, if empty, use/bin/sh
Default value/dev/default/passwd "Shell=/bin/bash"
(2)/etc/shadow
Format: Name:password:last_chage_date:minimum_age:Maximum_age:warning_period:inactivity_period
: expiration_date:reserved_filed
1 Name:login Name
2 password:encrypted password, encrypted password
Encryption algorithm: md5sum (Message digest), Sha1sum (Secure Hash algorithm), Sha224sum, Sha256sum, Sha384sum, sha512sum
The characteristics of these cryptographic algorithms:
Butterfly Effect: A small change in initial conditions will cause a huge change in results
Fixed-length output
The password also added impurities to avoid different users of the same password encryption after the same password
3 last_chage_date:date of last password changes, the date of the most recent password change
4 minimum_age:minium password age, change password minimum interval
5 maxinmu_age:maxinum password age, password maximum lifetime
6 Warning_period:password Warning Period, the number of days before a password are going to Expier
During which the user should be warned to warn users before password aging
7 Inactivity_period:password Inactivity Period, the number of days after a password have expired during
which the password should still be accepted, the number of days after the password has not been modified to keep the password available
8 Expiration_date:account expiration date, user expiration
(3)/etc/group
Format: group_name:password:GID:user_list
Groupa:x:504:zhubiao,xiaocao,user1,user12
1 Group_name:the name of the group
2 Password: Use x placeholder, password saved in/etc/gshadow
3 Gid:group ID
4 User_list:a List of usernames that is members of the this group, the groups contained in the user, between multiple users with "," separated
(4)/etc/gshadow
Format: group_name:password:administrators:members
Groupd:!::user12
2. useradd:create a new user or update default new user information
-U:--uid uid value range [Min_uid, Max_uid], this value must is unique
-G:--gid Group the group name or group ID, the group name and group ID must exit. Group name or group number, group must exist
-C:--comment comment, any text string
-D:--home home_dir, home directory path, preferably the path was not previously present, the default path is defined by the/etc/default/useradd file,
Directory configuration files are copied from/etc/skel/
-S:--shellshell, default path specified by/etc/default/useradd file
-G:--groups group1,group2,group3 ..., additional group
-M: Do not build home directory (System user default)
-M: Build User home directory (normal user default)
-D:--defaults
-G:--gid GROUP,/etc/default/useradd "group=100"
-B:--base-dir HOME,/etc/default/useradd "Home=/home"
-F:--inactive inactive, the numser of days after a password have expiered before the account would be disabled,
Change the password is still not modified after the password is still available for the period,/etc/default/passwd "inactive=1"
-e:--expiredate EXPIRE, account availability period,/etc/default/useradd "expire=30"
Three. Linux User and Group management