Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

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

I tried to delete a user:

# deluser someuser
Removing user `someuser' ...
Warning: group `someuser' has no more members.
userdel: user someuser is currently logged in
/usr/sbin/deluser: `/usr/sbin/userdel someuser' returned error code 8. Exiting.

I ran who

# who
myuser pts/0        2013-12-19 23:00 ...

It only shows me logged in. I really need to delete this user but I don't have their password, I have sudo password however. How can I delete it?

share|improve this question
    
I'm not sure how having their password would help, but you can force-ably set their password with sudo passwd someuser – virtualxtc Dec 20 '13 at 4:12
    
That doesn't log them out @virtualxtc But keep that as a comment here because that's still good to know – JohnMerlino Dec 20 '13 at 4:30
1  
Stupid question, I know, but have you restarted the system? Sometimes that can clear something and get it back working. – RPi Awesomeness Dec 20 '13 at 4:34
    
I ended up doing reboot, I was wondering if there was a method that didn't involve reboot – JohnMerlino Dec 20 '13 at 6:13
    
I hope you don't want to delete a system user. who will only show the users who are actually logged in, not those one who are in a session with su or sudo. E.g if you su someuser then someuser won't show up in who. – falconer Dec 20 '13 at 9:03

In the man page of deluser, it says that an error code of 8 indicates that the perl paquet "perl-modules" is not installed, maybe you can check this...

Anyway, if you want to force deletion you can use deluser with -f option

deluser -f

but do it only if you don't find another way, it can produce instability... See man page for more information

share|improve this answer

I encountered the same problem when trying to delete a user that was logged in the first time I tried to delete it. To me, waiting a few seconds was the solution:

As I mentioned, the first attempt to delete the user failed for it was still logged in. I then logged out the user and repeated the

sudo deluser -remove-home <username2delete>

command, but the

/usr/sbin/deluser: `/usr/sbin/userdel <username2delete>' returned error code 8. Exiting.

showed up again. This time with some process ID that currently seamed to be used by "username2delete".

I checked which users are logged in and there was only one user logged in "user2stay".

I then read your posts and after 2 minutes I tried again the same command as before:

sudo deluser -remove-home <username2delete>

This time it worked without problems. There was no reboot necessary nor a forced deluser. Maybe this will help you.

share|improve this answer

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.