Sixth chapter user account and group management
Section I user classification
Section II User account creation and management
Create a user account
Useradd user1
Create a user password
passwd user1
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/73/CC/wKiom1YH38Hxzwz-AAHQKZLyulk371.jpg "title=" 1.png " Width= "615" height= "255" border= "0" hspace= "0" vspace= "0" style= "width:615px;height:255px;" alt= " Wkiom1yh38hxzwz-aahqkzlyulk371.jpg "/>
View user Information
ID User1
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/73/C9/wKioL1YH4NzRx7OOAABocxPTAl8574.jpg "title=" 2.png " Width= "615" height= "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:615px;height:44px; "alt=" Wkiol1yh4nzrx7ooaabocxptal8574.jpg "/>
View files for user information
cat/etc/passwd
View files that hold user password information
Cat/etc/shadow
Delete a user account
Userdel user1 the deletion will only User1 from /etc/passwd The configuration file is deleted,
and User1 directory is not deleted, the directory remains in the /Home directory.
Userdel-r user1
The /etc/passwd configuration file is deleted, and the /home/user1 directory is deleted.
Create a virtual user account
A virtual user account that can only access a specific directory without the permission to log on to the system.
vim/etc/passwd
opens the/etc/passwd file, finds the User1:x:1001:1001::/home/user1:/bin/bash line,
after entering insert mode , change its/bin/bash to /sbin/nologin, and then save to exit.
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/73/CC/wKiom1YH5C7iLOypAAMDzr8r9zI732.jpg "title=" 3.png " Width= "615" height= "178" border= "0" hspace= "0" vspace= "0" style= "width:615px;height:178px;" alt= " Wkiom1yh5c7iloypaamdzr8r9zi732.jpg "/>
Section III User group creation and management
-
create user group
650) this.width=650; "Src=" http://s3.51cto.com/wyfs02/M01/73/CE/ Wkiom1yie57bk-isaaa2jlwddps412.jpg "title=" 4.png "width=" 615 "height=" "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:615px;height:33px, "alt=" wkiom1yie57bk-isaaa2jlwddps412.jpg "/>
< Span style= "font-family: ' The song Body '; >
-
create user group password
< Span style= "font-family: ' The song Body '; >GPASSWD public
650" this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/73/CE/wKiom1YIe__y8QNmAABzVwO6SwQ903.jpg "title=" 5.png "width=" 615 "height=" 80 " Border= "0" hspace= "0" vspace= "0" style= "width:615px;height:80px;" alt= "wkiom1yie__y8qnmaabzvwo6swq903.jpg"/>
View User group information
Cat/etc/group
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/73/CB/wKioL1YIfHOxsLeWAADsPCjo-DQ950.jpg "title=" 6.png " Width= "615" height= "237" border= "0" hspace= "0" vspace= "0" style= "WIDTH:615PX;HEIGHT:237PX;" alt= " Wkiol1yifhoxslewaadspcjo-dq950.jpg "/>
View security group account information
Cat/etc/gshadow
Modify Group Name
Groupmod-n test public will change the public group name to test
Delete a group
GROUPDESL Test
Section Fourth user accounts and group management
User account added to group
Gpasswd-a User1 public Add user account User1 to the public group
Delete User in Group
gpasswd-d user1 public to remove user account User1 from the public group
You can add user accounts directly to a group when creating a user account, provided that the group first creates a good
Useradd-g Shanghai User1 create User1 and add User1 to Shanghai Group
Add user accounts to multiple groups at the same time
Useradd-g shanghai,beijing User2 will user2 account added to Shanghai and Beijing two groups at the same time
Sixth chapter user account and group management