Linux Learning Notes (3) - Users and user groups

Today's headlines Search 三线城市程序员老陈video tutorials, or talk about technology and life, very welcome throat.

user level

2 grade root, non-root

root highest authority, only a root user, the user name is root

Non-root restricted rights, can only access the root file specified

home directory

Log Users have their own file directory, usually / home / xxx, xxx note is the user name, the directory xxx is the user's home directory.

Outside the home directory is a public directory, usually read-only directory.

user group

A user can belong to multiple user groups, but have at least one user group. User group is actually similar to the concept of roles to describe what files users can access.

/ Etc / passwd to store user information

/ etc / passwd to store information about users, look as shown below:
Here Insert Picture Description
Remove the line Analysis:

root x 0 0 root /root /bin/bash
username password UID GUIDE Full name home directory shell

Note that the password is x, do not let you see the mean; UID User ID is a user ID, GID Group ID is a user group number; UID = 0 is a root user, GID = 0 represents the root user group.

/ Etc / group store user group

Use cat View user group information as follows:
Here Insert Picture Description
This is relatively simple, we Analysis

root x 0
User group name password GUIDE User name in the user group

Note that within the user group user name, user name contains other information belonging to the group.

User and user group management

command Features Examples Explanation
useradd Add user useradd tom Need root privileges
passwd Modify their own password passwd xxx After logging modification
passwd Others modify the password passwd tom Need root privileges
userdel delete users userdel -r tom And delete user home directory
groupadd Add User Group groupadd admin
groupdel Deleting User Groups groupadd admin
his Switch User are the
whoami View the current user whoami
Published 397 original articles · won praise 270 · views 550 000 +

Guess you like

Origin blog.csdn.net/woshisangsang/article/details/104401763