Basic information for users:/etc/passwd
User Shadow Password:/etc/shadow
Basic information for groups:/etc/group
Shadow password for group:/etc/gshadow
/etc/passwd file explanation [[email protected] ~]# cat/etc/passwdroot:x:0:0:root:/root:/bin/bashbin:x:1:1:bin:/bin:/sbin/ Nologindaemon:x:2:2:daemon:/sbin:/sbin/nologinadm:x:3:4:adm:/var/adm:/sbin/nologin the 7 columns above represent: 1, login 2, password placeholder 3, UID 4, GID 5, user information 6, user home directory 7, the user login shell
/etc/shadow file explanation [[email protected] ~]# cat/etc/shadowroot:$6$1hlftktqnwrfmdae$ pygewrfopin7pjoa3d3aymj37udveonqfnquzgufgq.8vfraelkchmc2w6seg5efc51hrlvli7s/dcjug6upu0:17105:0:99999:7:::bin:* : 15980:0:99999:7:::d aemon:*:15980:0:99999:7::: The columns above represent: 1, login 2, encrypt password, so the field is displayed as!! or * indicates that this user is locked 3, from 1970 to the password last modified the number of days elapsed 4, password minimum age 0 means no Limit 5, password maximum age 6, password expiring reminder
User Category:
Admin: UID is 0
Normal User: UID is 1-65535
System User: UID is 1-499
General User: Uid bit 500-65535
Group Category :
Private group: Create user Yes, if no owner is specified, a group with the same name as the user name is created automatically, and this group is the private group
Basic group: User's default genus Group
Additional groups: groups other than the base group
User Management related commands
Useradd, Usedel, Usermod, passwd, Chsh, ID, chage
Useradd: Adding users
Format: useradd [options] USERNAME
Useradd default configuration file:/etc/default/useradd
[[email protected] home] #useradd Yull
-U UID: Specifies user uid, requires greater than 500, and is not used
-G GID: Specifies the basic group GID, which requires the specified GID to exist beforehand
-C "STR": Specify user information, such as user name, phone, etc.
-d/path: Specify user home Directory
-s/bin/bash: Specifying the user-available shell
-R: Adding system users
ID: View user account attribute information
[Email protected] home]# Id-unroot
Parameters:
-G or--group displays the ID of the group to which the user belongs.
-G or--groups displays the ID of the additional group to which the user belongs.
-N or--name displays the name of the user, the owning group, or the additional group.
-R or--real displays the actual ID.
-U or--user displays the user ID.
-help display Help.
-version displaying version information
Userdel: Delete user, home directory is not deleted by default
[Email protected] home]# Userdel-r User01
-R USERNAME: Delete user and delete home directory
Usermod: Modify user account attributes, usage and useradd almost consistent
[Email protected] home]# usermod-u 1002 User01
-a-g GID: If the-a option is not applied, the user's previous additional groups will be overwritten
-d-m/path: Specify a new home directory and move the old home directory content to the new home directory. Common use of a piece
-L USERNAME: Modify user logon name
-E yyyy-mm-dd: Modify user Expiration Time
-L USERNAME: Lock user account
-U USERNAME: Unlock user account
Chsh: Modify with User Default shell
[Email protected] home]# Chsh user02changing shell for User02. New Shell [/bin/bash]:/bin/tcshshell changed.
passwd: User Password management
[Email protected] home]# echo "123456" | passwd--stdin user02changing password for user User02.passwd:all authentication tokens updated successfully.
--stdin: Avoid interactive input create password
-L USERNAME: Lock user
-U USERNAME: Unlocking password
-D USERNAME: Delete user password, delete password cannot login, but can Su
Group Management related commands
Groupadd, Froupdel, Groupmod, gpasswd
Groupadd: Adding groups
[Email protected] home]# Groupadd MyGroup
-R: Add system Group, ID less than bit 1-499, single no Home directory
Groupmod: Modifying Group properties
[Email protected] home]# groupmod-n mygroup01 mygroup
-G: Modify GID
-N: Modify Group name
This article from "Liang Childe" blog, please be sure to keep this source http://iyull.blog.51cto.com/4664834/1882854
Linux Basics-Users and Groups