Xen Asked: 2012-05-04 13:03:19 +0800 CST2012-05-04 13:03:19 +0800 CST 2012-05-04 13:03:19 +0800 CST Unable to remove user: "user is currently logged in" 772 When trying to remove the user, it returns "user is currently logged in". I already killed the user using pkill -KILL -u usernameHere and several other commands, but it does not help. How can I remove this user? Running CentOS 6. centos users remove 4 Answers Voted Best Answer ewwhite 2012-05-04T13:09:25+08:002012-05-04T13:09:25+08:00 SU to the user su - username and run kill -9 -1 as the user. Exit the shell and try the userdel -r username again. Or you can check for processes from the user using lsof -u username and kill the relevant PIDs. Or pkill -u username or pkill -u uid Sirch 2012-05-04T13:18:43+08:002012-05-04T13:18:43+08:00 Or ps aux | grep <username> and kill the processes the user is running. MohanBabu 2018-09-15T17:14:02+08:002018-09-15T17:14:02+08:00 If the above steps don't help! (Assuming you are using on the runlevel 5) You could try the following: Change the runlevel to 3 (init 3) log-in with other than deleting account to delete (root/other account) userdel -r username Eric Kung 2016-04-05T04:00:06+08:002016-04-05T04:00:06+08:00 I try the steps to del the user1 su user1 kill -9 -1 su sudo deluser user1
SU to the user
su - username
and runkill -9 -1
as the user.Exit the shell and try the
userdel -r username
again.Or you can check for processes from the user using
lsof -u username
and kill the relevant PIDs.Or
pkill -u username
orpkill -u uid
Or
ps aux | grep <username>
andkill
the processes the user is running.If the above steps don't help! (Assuming you are using on the runlevel 5)
You could try the following:
init 3
)userdel -r username
I try the steps to del the user1
su user1
kill -9 -1
su
sudo deluser user1