Home >Operation and Maintenance >Linux Operation and Maintenance >How to delete users and groups in linux
In Linux, you can use the userdel command to delete users and clear the relevant data of the specified deleted user. The syntax is "userdel -r username"; you can use the groupdel command to delete user groups. The syntax is "groupdel group name". .
#The operating environment of this tutorial: linux5.9.8 system, Dell G3 computer.
There are four corresponding relationships between users and user groups:
One-to-one: one user can exist In a group, he is the only member of the group;
One-to-many: A user can exist in multiple user groups, and this user has the common permissions of these multiple groups;
Many-to-one: Multiple users can exist in a group, and these users have the same permissions as the group;
Many-to-many: Multiple Users can exist in multiple groups, which is an extension of the above three relationships.
The relationship between users and groups can be represented by the following figure:
linuxDelete user
In Linux, you can use the userdel command to delete a user and delete data information related to the specified user.
The syntax of the userdel command is very simple. The basic format is as follows:
userdel -r 用户名
-r
option indicates that the user’s home directory will be deleted while deleting the user. .
Note that if you do not delete the user's home directory when deleting the user, the home directory will become a directory without an owner or group, which is a junk file.
Example: Delete lamp user
userdel -r lamp
linux delete user group
In Linux, you can use the groupdel command to delete user groups (groups) , the basic format of this command is:
groupdel 组名
Example: Delete group users
groupdel users
Related recommendations: "Linux Video Tutorial"
The above is the detailed content of How to delete users and groups in linux. For more information, please follow other related articles on the PHP Chinese website!