Get the App
SLTechnology News&Howtos  ›  Development  › 

How does Linux delete the user completely?

Shulou Source: shulou.com Published: 2022-06-01 21:16:41 09月25日 Update

This article introduces the knowledge of "how to delete users completely from Linux". In the operation of actual cases, many people will encounter such a dilemma. Then let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

1. First enter the system to create a user

[root@localhost /] # useradd # create user is the user name [root@localhost /] # passwd # set the password for this user and change the password of user . New password: * after the password is set, prompt "passwd: all authentication tokens have been updated successfully." Indicating that the password has been set successfully

2. Check the directory of some information about the user.

3. Delete a user

If you use the userdel command to delete the user, you cannot delete all the information of the user, just delete the information of the account and group in the four files / etc/passwd, / etc/shadow, / etc/group/, / etc/gshadow. By default, a user account is created, which creates a home directory and a user mailbox (named after the user name in the / var/spool/mail directory)

[root@localhost /] # userdel [root@localhost /] # cat / etc/passwd | grep [root@localhost /] # cat / etc/shadow | grep [root@localhost /] # cat / etc/group | grep [root@localhost /] # cat / etc/gshadow | grep [root@localhost /] # find /-name "* *"

The next time you create a user, it appears:

The error is reported in the image above, so you will report an error when you create the user account again, which means that the files or directories related to the user have not been deleted completely before.

4. Delete the user correctly

[root@localhost /] # userdel-r and then use the find command to view, user-related files have been deleted.

This is the end of the content of "how to completely delete users from Linux". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Tags: User password directory information file success content command situation more user name knowledge account practical successful next picture above token will be created again Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL vpn MariaDB Xiaomi Docker