Related profiles for users and groups
Manage Users and Groups
categories of users :
depending on the location of your account : local account , remote ( domain ) Account LADP
based on the function of the account : superuser (Root) uid:0
Normal User
System User UID 1-499 Local user UID
categories of groups :
categories of users :
depending on the location of the account : Local group , remote ( domain ) Group LADP
based on the function of the account : Super user group (root) uid:0
general user groups
system user Group uid 1-499 local user group uid
Each user has a group with the same name
about configuration files for system users and groups :
account information password information
Users :/etc/passwd/etc/shadow
Group /etc/group/etc/gshadow
/etc/passwd The role of each field
Root:x:0:0:root:/root:/bin/bash
User name : Password placeholder : uid:gid: User Description : User home directory : the shell used after landing
passwd Middle pseudo user :
bin have executable user command file
SYS owning system files
ADM own account file
UUCP UUCP Use
LP LP or LPD Subsystem Usage
Nobody NFS Use
/etc/shadow Structure
1root:$6$mkafxshc3tvuowse$vhaepja7m1sbrjmsuz1m5qj7xvasrmw/ab2r4. Njyb5ifotk/zk Qnedtob2qy2/ya15iuuibk0xqw6dncm4j./:16848:0:99999:7:::
Root User Name
$6mk .... 4j. encrypted password (rhel5 with MD5 rhel6 SHA512 Encryption)
16848 Date The password was last changed or the date the password was created from 19700101 Start Calculation
0 Number of days the password cannot be changed: only a few days after the recent change can be changed 0 means you can change it at any time
999999 Password Expiration Time that How many days must be modified again
7 password needs to be changed before the deadline arrives 7 Day to issue a warning
Grace days password expires after a few days can also change the password
account expiry time
reserved
Useradd-e 01/01/17
Usermod-e 2016-10-10
chage-m password Keep maximum days -M minimum number of days to change password
Date-d "1970-01-01 +16897day" + "%y-%m-%d"
Know
/etc/group configuration file Structure
Greproot/etc/group
root:x:0:
Root Group name x Group Password placeholder 0 GID
Add user-related commands
Grammar useradd username
-uuid-d Home Directory -G Start Group -G Additional group -S the shell used
Example
Useradd-u Zhen
Idzhen
uid=1000 (Zhen) gid=1000 (zhen) groups=1000 (zhen)
650) this.width=650; "src=" http://s4.51cto.com/wyfs02/M01/7E/AF/wKiom1cHF7ORr4WRAADT4tln_4M537.jpg "title=" 1.jpg " alt= "Wkiom1chf7orr4wraadt4tln_4m537.jpg"/>
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/7E/AF/wKiom1cHF9rS8nJgAADF6BJtbjw833.jpg "title=" 2.jpg " alt= "Wkiom1chf9rs8njgaadf6bjtbjw833.jpg"/>
Commands about the user's password
passwd Modify the current user password
Non-interactive
echo123456 | passwd--stdin Root
650) this.width=650; "src=" http://s2.51cto.com/wyfs02/M00/7E/AF/wKiom1cHF-bTPQ_NAACHZy4uy00997.jpg "title=" 3.jpg " alt= "Wkiom1chf-btpq_naachzy4uy00997.jpg"/>
Understand
Linux User Password Encrypt
123456--> sha512--$6$KN1ZIOJC$YCU
123456 Random value -sha512---> $6$kn1ziojc$ycudo3lwqxc
Validation
123456 + Random value -sha512---> $6$KN1ZIOJC$YCUDO3LWQXC
To Modify user information :
Grammar usermod username
-uuid-g Start Group -G Additional Group -D Home Directory -S Login Shell
Delete User
Userdel username-r Delete the user home directory when deleted
Userdel-r Test7
Add Group
Groupadd Test9
Modify group Information
Groupmod-g GID GroupName
Groupmod-g 1003 Test9
Delete a group
Groupdel GroupName
Understand
Vim/etc/defualt/useradd Control Add user's rule file
Home=/home # which directory to store as the user's home directory
Inactive=-1
Expire=
Shell=/bin/bash # default shell when adding users use which
Skel=/etc/skel # Template Catalog
Create_mail_spool=yes
View user Information related commands
Idtest2 WhoAmI w/who
User Switching:
Su-username plus - user and shell environment switch together
650) this.width=650; "src=" http://s5.51cto.com/wyfs02/M00/7E/AF/wKiom1cHGITyqQmqAAIMc-ufvlk579.jpg "title=" 1.jpg " alt= "Wkiom1chgityqqmqaaimc-ufvlk579.jpg"/>
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/7E/AB/wKioL1cHGUDCFgt7AAN5mE9yr_A674.jpg "title=" 2.jpg "alt=" wkiol1chgudcfgt7aan5me9yr_a674.jpg "/> modified file owner owned group
Single-user mode retrieve user password
Boot Press any key when entering the countdown
650) this.width=650; "src=" http://s5.51cto.com/wyfs02/M01/7E/AB/wKioL1cHGUzjtkxaAABF4OKid08545.jpg "title=" 3.jpg " alt= "Wkiol1chguzjtkxaaabf4okid08545.jpg"/>
Press e Edit
650) this.width=650; "src=" http://s1.51cto.com/wyfs02/M00/7E/AF/wKiom1cHGNry76GsAADauc63Nd4497.jpg "title=" 1.jpg " alt= "Wkiom1chgnry76gsaadauc63nd4497.jpg"/>
Select the second line kernel press e to edit
650) this.width=650; "src=" http://s1.51cto.com/wyfs02/M02/7E/AB/wKioL1cHGZiyQ7E0AAEjwH6hGLw859.jpg "title=" 2.jpg " alt= "Wkiol1chgziyq7e0aaejwh6hglw859.jpg"/>
Space Input 1
650) this.width=650; "src=" http://s2.51cto.com/wyfs02/M00/7E/AB/wKioL1cHGavwhftGAADdSKEZvQU284.jpg "title=" 3.jpg " alt= "Wkiol1chgavwhftgaaddskezvqu284.jpg"/>
Enter Press b Start
650) this.width=650; "src=" http://s5.51cto.com/wyfs02/M02/7E/AF/wKiom1cHGV6wOcXkAAFukefd06M706.jpg "title=" 1.jpg " alt= "Wkiom1chgv6wocxkaafukefd06m706.jpg"/>
Enter single-user mode
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/7E/AF/wKiom1cHGWnSUi_xAAB2Kc8TVtk429.jpg "title=" 2.jpg " alt= "Wkiom1chgwnsui_xaab2kc8tvtk429.jpg"/>
passwd Change your password
Rhel7
650) this.width=650; "src=" http://s2.51cto.com/wyfs02/M02/7E/AC/wKioL1cHGirxEMhKAAONaBKCWaQ580.jpg "title=" 3.jpg " alt= "Wkiol1chgirxemhkaaonabkcwaq580.jpg"/>
This article is from the "Linux small z" blog, please be sure to keep this source http://3179394.blog.51cto.com/3169394/1761645
Linux Users and Groups