User and Group Management
Linux is a multi-user multi-tasking network operating system, as a network administrator, it is essential to master the creation and management of user groups.
Learning Essentials:
- Understand the profiles of users and groups of the group.
- Familiar with the creation and maintenance management of Linux users.
- Familiar with the creation and maintenance management of Linux under the cluster.
- Be familiar with how User Manager is used.
First, the user account (user) under the Linux system mainly consists of 3 kinds of
- Super User (Admin User: root)
- Normal User (login user, login account): Created by the system administrator, can log on to the Linux system, but only the files within their own directory, limited permissions.
- System User: Mainly used for applications, support maintenance system operation, but the system running indispensable users, such as: bin,daemon,adm,ftp and Mail and other user accounts, are built-in users of Linux system (generally do not consider).
#su命令
Function: Transition to another user.
Format: su [-] User name
Note: When you do not specify a user name, you convert to root, and when you specify the-option, the environment is also transformed. When an ordinary user executes Su, it is necessary to enter the user name of the user to be converted.
* New User *
#useradd user1
Function: Create a new user home directory with the same user name by default
#useradd-D/home/xf user1
Function: Specify the user's home directory
#useradd-S/bin/false user1
Function: User Login-"shell program:/bin/bash, if do not want this user to log in, can modify the shell program is:/bin/false, this with the user even if the login can not execute the linux command.
#useradd-G user User1
Function: Specify a group that already exists for the user
#useradd-G user User1
Function: Let the user belong to another group again
Table 1-1
Table 1-2
Modify User
#usermod option User Name
-D: Modify the user's home directory #usermod-D/ljj/user1 user1
-L: Modify the user's account name #usermod-L USER11 user1
-G: Change the user's base group
-G: Change the user's additional group #usermod-G group1 user1
-C: Modify note information
-E: Modify the expiration date of the account
-S: Modify the shell used when logging in
-L: Lock user password
-u: Unlock user password
Delete User
#userdel-R user1
Features: delete users and delete their home directories
Group of Accounts (group)
A group is a collection of users who can share files and other system resources;
The principle of grouping is divided by working relation or user nature;
The correspondence between users and groups is many-to-many, and a group can contain multiple users, with the same group permissions as the group users.
Table 2-1
New User Group
#groupadd Group Name
#groupadd group1
#groupadd group2
#groupadd Group3
#groupadd GROUP4
#groupadd-G GID (group number) Gname (group name)
#groupadd-G 530 group2
Features: New user group
Ways to add users to a group
- Specify the GID for this group when creating a new user
- Modify the group properties of an existing user with the Usermod command
- Modify the passwd and group files directly.
- #gpasswd-a group1 user1
Delete a user group
#groupdel user Groups
#groupdel group2
Linux System user and group management