Operating System - HP-UX
1833784 Members
2862 Online
110063 Solutions
New Discussion

Root user has been deleted!

 
SOLVED
Go to solution
John Ross_1
Occasional Advisor

Root user has been deleted!

The Root user has been deleted on an HP-UX 11.0 system I have. It has been a while since I have had to deal with this type of occurance on HP-UX.

Wouldn't I be able to reboot into single user mode and modify the password file, or do I have to boot from CD? Any suggestions?
10 REPLIES 10
Pete Randall
Outstanding Contributor

Re: Root user has been deleted!

John,

By deleted, do you mean that there is no uid 0 entry in /etc/passwd? If so, I would not recommend trying to boot into single user mode, since that automatically logs you in as uid 0. Never having used the recovery CD, I'm not sure whether that would help or not.

Can you restore a copy of the password file from backup or copy it from another machine? Or copy it to another machine, edit it and copy it back?


Pete

Pete
Jeff_Traigle
Honored Contributor
Solution

Re: Root user has been deleted!

Without the root user, the system will basically only boot to single user mode anyway. (Found out when I accidentally blew away the entire password file in some automation scripts I wrote for some system installers... can we say, "Oops!"? :)

Once you're in single user mode, you should be able to append an entry for root like so:

echo "root::0:3:/:/sbin/sh" >> /etc/passwd
--
Jeff Traigle
Rick Garland
Honored Contributor

Re: Root user has been deleted!

Yo9u can boot into single user mode. That will be all you can boot into.

Once there, make the root entry in the /etc/passwd file

UID=0 and GID=0

Raj D.
Honored Contributor

Re: Root user has been deleted!

John ,

Its good to boot in single user mode and restore the passwd file from backup.
Then take a reboot or init 4.

Hope this will help.

Cheers,
Raj.
" If u think u can , If u think u cannot , - You are always Right . "
Steven E. Protter
Exalted Contributor

Re: Root user has been deleted!

Shalom John,

I assume this machine is not part of an NIS domain or ldap where root access may not authenticate to /etc/passwd (though this scenario is crazy).

You might wish to look into the cause after fixing it.

bdf /

If the root filesystem is nearly full, there is a nasty characteristic of HP-UX 11.00 that when root hits 100% /etc/group gets hammered. Sometimes other important files.

You need to after fixing this run some management scripts to check system health on this box regularly. I'm assuming this was not a vi screwup and the actual cause is a mystery.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Belinda Dermody
Super Advisor

Re: Root user has been deleted!

I also have a root2 user setup in my passwd file pointing to uid 0 with a different shell start up just for this reason. I then have a backup way to get into the system...
Rick Garland
Honored Contributor

Re: Root user has been deleted!

This will work but be aware of the "suggestions" that say no more than 1 UID=0 account.

John Ross_1
Occasional Advisor

Re: Root user has been deleted!

Thanks folks for the responses. Appending the root entry to the password file worked. I was a bit hesitant to reboot without the root user, as I didn't know how it would fare coming up in single user mode, but it worked like a charm!

Thanks
Raj D.
Honored Contributor

Re: Root user has been deleted!

John,

Its a good practice to assign some points to those responses who tried to help you.

Your profile:
"I have assigned points to 1 of 12 responses to my questions"

Try to make 12 of 12 , and make forum profile better.


Happy fouruming.


hth,
Raj.


* 0 point pls.
" If u think u can , If u think u cannot , - You are always Right . "
John Ross_1
Occasional Advisor

Re: Root user has been deleted!

Thanks for all the replies. I was able to boot into single-user mode without a root user (pretty neat) and then appended a root entry as mentioned. Worked like a charm.