Steps to delete ordinary users under Linux

1. First use the command cat /etc/passwd to check all users and you can see the username you need to delete

2. Use the command who to query the currently logged in user

3. Use the command ps -u username to view the pid of the user

4. Kill his sshd or shell process with the command kill pid

5. Use the command userdel -r username to delete the user

If the user is logged in when ucenter is deleted, the following figure is shown:

I have determined that the connection of the ucenter user has been closed locally, so I use the w command under the root user to see the current user connection status of the Linux system,

As shown below:

The current Linux server is just me as a user (I'm using the root user at this time). At this point, it is very depressing, obviously I have only one root user on the Linux server, why does it report that the user ucenter is currently logged in when I delete the ucenter user?

Solution : I am under the root user and enter the command ps -ef |grep ucenter, as shown in the figure:

As shown by the red arrow in the query, there is still a process that has not been closed. Now use kill 1715 to kill this process and then run the delete user command userdel -r ucenter to delete the user!

Guess you like

Origin blog.csdn.net/m0_54883970/article/details/124289370