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
This article introduces the command statements fo...
HTML beginners often encounter the problem of how ...
Using fonts on the Web is both a fundamental skill...
Preface Today, when I was designing a feedback fo...
Table of contents Audio transcoding tools princip...
This article example shares the specific code of ...
The following information is compiled from the Int...
Mac latest version of MySQL 8.0.22 password recov...
Preface This experiment prepares two virtual mach...
Table of contents 1. Registering custom instructi...
The form elements with visibility=hidden and displ...
Deployment environment: docker container, liunx s...
Table of contents v-model .sync The difference in...
As shown below: As shown above, just replace it. ...
Table of contents 1. Object properties 1.1 Attrib...