Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
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.
SU to the user su - username and run kill -9 -1 as the user.
su - username
kill -9 -1
Exit the shell and try the userdel -r username again.
userdel -r username
Or you can check for processes from the user using lsof -u username and kill the relevant PIDs.
lsof -u username
Or pkill -u username or pkill -u uid
pkill -u username
pkill -u uid
Or ps aux | grep <username> and kill the processes the user is running.
ps aux | grep <username>
If the above steps doesn't help.! (Assuming you are using on the runlevel 5 )
I try the steps to del the user1
sudo deluser user1
Required, but never shown