In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail how to delete user accounts in Linux system, Xiaobian thinks it is quite practical, so share it with you as a reference, I hope you can gain something after reading this article.
What is userdel?
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 deletes all entries associated with 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 get an error message "only root privileges can perform this operation" or something similar. After we get privileges, we can delete users from your console by typing userdel. The following is an example of userdel being used by default.
$ sudo userdel pasadena
or
# userdel pasadena
As you can see, we cannot delete user pasadena without root privileges. When we have permission, the system does not give an error message, which means that the user has successfully deleted.
Delete user home directory completely
Using userdel without options will only delete users. The user's home directory will still be in the/home directory.
When we enter the/home directory, we can still see that ID 1002 owns the pasadena folder. Created users usually have a group name that is the same as the user name. 1002 is the UID of the pasadena user name and the GID of the pasadena group name.
To delete the home directory completely when deleting users, we can use the-r option. This option also deletes the user's mail pool, if it exists.
Forcefully delete a user
userdel provides the-f option to force deletion of users. This option works even when the user is logged in to Linux. Take a look at the sample screenshot.
The screenshot above shows that user pasadena has logged into the system. Its tagged process 6218 is an SSHD process. When we use "userdel -f pasadena" only the logged in users will be deleted. The order itself succeeded. If we use the cat command to look at the contents of/etc/passwd, we don't see that user pasadena exists. His home directory still exists but the owner can only be shown as a numeric ID.
One thing we must understand is that userdel with the-f option does not break the SSH link that the user already has. Therefore, even if the user no longer exists, he is still logged in and is an active user. However, when the user logs out, he cannot log in again because the user has been deleted.
So this option is somewhat dangerous to use because it puts your system into an inconsistent state.
About "how to delete user accounts in Linux system" this article is shared here, I hope the above content can be of some help to everyone, so that you can learn more knowledge, if you think the article is good, please share it to let more people see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.