0

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 ?

Eric Carvalho
  • 55,453
Grigory
  • 101

2 Answers2

0

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

Eric Carvalho
  • 55,453
BDRSuite
  • 3,196
  • 1
  • 13
  • 11
0

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...

Fabby
  • 35,017