Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 39 down vote accepted

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

share|improve this answer

Or ps aux | grep <username> and kill the processes the user is running.

share|improve this answer
    
This was the first thing I tried before Googling this. When I did it, I got nothing in the grep results. – Vic Aug 8 '14 at 21:25

I try the steps to del the user1

  1. su user1

  2. kill -9 -1

  3. su

  4. sudo deluser user1

share|improve this answer
    
I don't see anything new in this answer. And the older answers have better explanations of what they are doing. – kasperd Apr 4 at 12:53

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.