System Administration
Showing results for 
Search instead for 
Did you mean: 

Delete the User with UID '0'

Arun Jain
Frequent Advisor

Delete the User with UID '0'

Hi All,

I need to remove some users from the servers that are running HP-UX 11.00, 11.11 and 11.23 versions.

All the users share the same UID '0'. I have to just delete the user while I need to keep its home directory.

When I run the command : userdel username
It shows me the following message :
Login username is currently in use

When I try to do same from sam..
I shows that the user share the same UID as root, etc. Files and directories owned by this user cannot be reassigned to anyother user. Do you still want to remove the user .
Yes No.

Please suggest whether it is safe to delete the user with sam. Whether it will harm anyother user/process.

Regards :
Arun Jain
speak less say more
Hasan Atasoy
Honored Contributor

Re: Delete the User with UID '0'

hi arun,

I would delete this users by vipw utility. you need to know vi usage.

Honored Contributor

Re: Delete the User with UID '0'

the reason for the problem is that userid 0 should (normally) be reserved for "root" only. using sam or userdel can has the potential of rendering the system unusable.

The only "safe" way is to manually remove the users from the password file via "vipw".

If I were you, I would remove ALL non-root accounts that have UID 0.
Fadia Almarei
Super Advisor

Re: Delete the User with UID '0'

i think that you have to vi /etc/passwd file and trim the line that contains this user sho it will be not found then try to remove it

Re: Delete the User with UID '0'

>Fadia: I think that you have to vi /etc/passwd file

Instead you should do what Hasan & OldSchool said, use vipw, not vi directly on /etc/passwd.
(It also is easier to type. :-)
Bill Hassell
Honored Contributor

Re: Delete the User with UID '0'

> All the users share the same UID '0'.

I really hope that your system is only for testing. Even with a bunch of well-trained system administrators, having multiple users with UID 0 is a disaster waiting to happen. It also means that there is no accountability in case mistakes are made, and as you have seen, duplicate UID's make deleting users quite complicated.

Bill Hassell, sysadmin
James R. Ferguson
Acclaimed Contributor

Re: Delete the User with UID '0'

Hi Arun:

As already has been stressed, use 'vipw' to delete the '/etc/passwd' entries with the duplicate uid=0. Using 'vipw' instead of doing 'vi /etc/passwd' offers some checking of the password file and will prevent you from doing some forms of damage.

Remember that this will leave files and directories the are owned by 'root' as their uid=0 is really 'root' and not the duplicated alias name. Thus, you will need to hunt down the "orphaned" files and directories. Begin by noting the home directory of the users that you are deleting. At least some, or maybe all, of the user's files can be sorted-out from there.

You should now be able to see that you had not only a security hole and a maintenance nightmare, but a disaster waiting to happen had you used SAM and specified the removal of one of the users (with a uid-0) _and_ toggled the removal of all of his/her files! [ would have removed all of 'root's files!!! ]