What is serdel userdel is a low-level tool for deleting users. On Debian, we usually use the deluser command. userdel queries system account files such as /etc/password and /etc/group. Then it will delete all entries related to the username. The username must exist before we can delete it. How to use userdel Since userdel modifies system account files, we need root privileges to run it. Otherwise we will encounter an error message "Only root privileges can perform this operation" or similar messages. After we have gained privileges, we can delete the user from your console by typing userdel. Below is an example that uses userdel by default. or As you can see, we cannot delete the user pasadena without root privileges. When we have permission, the system will not give an error message, which means the user has been successfully deleted. Completely delete the user's home directory Using userdel without options will only delete the user. The user's home directory will still be in the /home directory. When we go into the /home directory, we can still see that ID 1002 has the pasadena folder. Created users will usually have a group name that is the same as their username. 1002 is the UID of the pasadena username and the GID of the pasadena group name. To completely remove the home directory when deleting a user, we can use the -r option. This option will also delete the user's mail pool, if it exists. Force delete a user userdel provides the -f option to force deletion of a user. This option works even when the user is logged into the Linux system. Please take a look at the example screenshots. The screenshot above shows that user pasadena has logged into the system. The process 6218 it is marked as is the SSHD process. When we use "userdel -f pasadena", only the logged-in user information to be deleted will be displayed. The command itself succeeded. If we view the contents of /etc/passwd using the cat command, we cannot see that the user pasadena exists. His home directory still exists but the owner is shown only as a numeric ID. One thing we must understand is that userdel with -f option will not disconnect the existing SSH connection of the user. Therefore, even though the user no longer exists, they are still logged in and are an active user. However, after the user logs out, he cannot log in again because the user has been deleted. Therefore this option is somewhat dangerous to use, as it can put your system into an inconsistent state. Summarize userdel is a tool for deleting users from within a Linux system. userdel is also the backend for the deluser command, which is a script written in perl to delete users. As usual, you can type man userdel to see more details about the userdel command. The above is a detailed tutorial on how to use the userdel command to delete Linux users. I hope it will be helpful to you. If you have any questions, please leave me a message and I will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website! You may also be interested in:
|
<<: Summary of Vue's common APIs and advanced APIs
>>: Detailed explanation and examples of database account password encryption
Preface 1. This article uses MySQL 8.0 version Co...
Sort Tool The Linux sort command is used to sort ...
Overview Today we will mainly share how to config...
Today I wanted to change the mysql port, but I fo...
Preface: After studying the previous article, we ...
Speaking of Nestjs exception filter, we have to m...
Public name of the page: #wrapper - - The outer e...
Transactions in MySQL are automatically committed...
I just started learning about databases recently....
One of our web projects has seen an increase in t...
1. The Linux server configures /etc/hosts.deny to...
Recently, I used the webSocket protocol when work...
You may already know that the length 1 of int(1) ...
When the DataSource property of a DataGrid control...
1. Overview 1.1 Basic concepts: Docker is an open...