How to bring back/restore root account?

Hi all,
I have a problem, when I use script with 'expect', accidentally I was deleted root account by "userdel root". Unfortunately, it works, because no other root user login on it. Solaris document said that root cannot delete root, but in my case it works because it deleted by script, not physically log in.
My question is: how to restore my root account? I can log in using other account, but not root and no other account have privilege as root.
Any help would be appreciated. Thank you

Regards,
Joash

boot from cd/dvd and create the root account again. haven't done something like that but i would try to copy the information for /etc/passwd and /etc/shadow from another machine.

Thanks DukeNuke2 for your help, I will try it.
But, could you please share to me, how the steps and to create again? only using 'useradd' ? or other command? or just add root line at /etc/passwd and /etc/shadow ?
Thank you

Got an idea :stuck_out_tongue:

Ok boot into solaris into solaris failsafe login , this will boot mini root
then mount FS on /a
then execute sys-unconfig

answer on few questions and you will be promoted to enter password for root , follow instructions , reboot PC and your root account maybe will be backed :cool:

This may also help:

How to recover/reset root password in Sun solaris

It says its just for recovering the root password, but I think when I did the same thing (messed up the root user) this fixed it..

Thank you guys..
It works now.. i did the same thing like restore root password and it works :slight_smile:

  • insert CD (I think it can be ignored)
  • send <break> on putty
  • at '{3} ok' prompt I type boot cdrom -s, but i also can do 'boot -s'
  • then restore manually by edit '/etc/passwd', '/etc/shadow', and '/etc/group'
  • done

Thank you

Dear Joash, Kindly take note, before you post a question, please do a search within the forum on your query. There are plenty of such examples for you to refer from.
Thanks. This is part of the forum rules :slight_smile:

Sorry, but I already searched it and find nothing (maybe I was input wrong keyword or not exactly).
Thank you