How to delete users and groups in linux

青灯夜游
Release: 2021-12-21 16:39:46
Original
25854 people have browsed it

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". .

How to delete users and groups in linux

#The operating environment of this tutorial: linux5.9.8 system, Dell G3 computer.

The relationship between Linux users and groups

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:

How to delete users and groups in linux

How to delete users and groups in Linux

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 用户名
Copy after login
  • -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
Copy after login

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 组名
Copy after login

Example: Delete group users

groupdel users
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template