Account: 1. You can log into the operating system
2. Access control can be performed (different user permissions differ)
Group accounts: Easy to manage user accounts (permissions)
User account and group account unique identifier: UID GID
Administrator UID is 0
Group accounts: Basic group additional groups (public groups, subordinate groups)
Add Users:
useradd [Options] User
Common Command options:-u user ID
-D Home Directory path
-S Login Shell
-G Basic Group
-G Additional Group
grep ' Zhangsan '/etc/passwd user basic information
Zhangsan:x:1002:1002::/home/zahngsan:/bin/bash
User name: Password placeholder: uid:gid: User's description: Home directory: Interpreter
Example: Useradd-s/sbin/nologin Lisi Specifies the interpreter (if the user
Interpreter is/sbin/nologin and cannot be logged into the operating system)
Useradd-u 1100 WANG Specifies UID
User password Information Store address/etc/shadow file
passwd command: echo password | passwd--stdin User name free interactive
Temporary Switch User identity command: Su-user name
To modify user properties:
usermod [Options] User
Common Command options:
-U User ID
-D Home Directory path
-S Login Shell
-G Basic Group
-G Additional Group
Example: Usermod-u 1200-d/opt/tset-s/sbin/nologin Lisi
To delete a user:
Userdel User name (delete home directory)
Add Group: Group basic information is stored in the/etc/group file
head-1 | /etc/group
root:x:0
Group name: Password placeholder: GID: Group member list
Groupadd hihi (add ' Hihi ' group)
GPASSWD command: Add user to Group
GPASSWD-A User Name Group name (add)
GPASSWD-D User Name Group name (remove user from Group)
GPASSWD-M User name + user name: Group name (multiple users can be added at the same time)
Example: Gpasswd-m ' Zhangsan,lisi,wang ' hihi (add multiple users to the ' Hihi ' group)
Gropdel: Deleting a group user
Example: Group Hihi (delete "Hihi")
Management of Linux users and user groups