I faced with small difference in behavior of userdel utility on Ubuntu 10.04 and 14.04 and now struggling trying to fix it. I have kind of "hardening" script which should remove user via userdel utility. It's a little bit ugly since it have to remove user which actually run this script. But changing this would be last option since it will lead to tons of managers flying around and arguing why behavior was changed...

So i use following command to remove user inside my script:
userdel -r -f administrator

On Ubuntu 10.04 it works perfectly and remove administrator user completely.
But on ubuntu 14.04 results looks slightly different:

userdel: user administrator is currently used by process ${PID of running hardening script}
userdel: cannot open /etc/subuid

Obviously I can't kill process since doing so I will kill my hardening script itself. So is there any way to remove user (let say by itself) at Ubuntu 14.04 ?

  • Maybe delete the user on next boot? Dec 9, 2014 at 16:20

2 Answers 2


sudo deluser <USER_NAME> is the command you need to use to remove a user.

  • Hi, thanks for advance but usage of this command leads to the same results which i mentioned for userdel.
    – Grigory
    Dec 9, 2014 at 16:14
  • Just to check, can you please check whether 1. Your root drive is having enough space. 2. Check the inode availability - You can get this by running the below command, df -i
    – vembutech
    Dec 9, 2014 at 17:21
  • There are a lot of free space available, i checked this.
    – Grigory
    Dec 10, 2014 at 22:01

What you're trying to do is to force a user to commit suicide... (and tell the manager that you would not be able to have him commit suicide neither)

So from within the running user deluser or userdel doesn't work. You need to create an additional user, or log in as root to do this.

See Unable to login as root from the login screen even though I have a root account how to log in as root and why it's also a bad idea...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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