Wednesday, 28 November 2012

Root Password Recovery in Solaris without CD/DVD

Follow the steps to recover the root password in Solaris without CD

For SPARC

i)Bring the server to OK prompt
#init  0

ii)Boot  the server  in failsafe mode from OK prompt (SPARC) . The failsafe mode is used to boot the server from RAM without any CD/DVD.
OK>boot  -F  failsafe
Starting shell.

#uname -a
SunOS 5.10 Generic_142909-17 sun4u sparc SUNW,Sun-Fire-V245

# df -k
Filesystem kbytes used avail capacity M ounted on
/ramdisk-root:a 201463 178943 2374 99% / ————> Server booted from   RAM.

iii)Once server will boot up in failsafe, mount your rootdisk at /a.
#mount  /dev/dsk/c1t1d0s0 /a

iv)Take a copy of /a/etc/passwd & /a/etc/shadow file.
#cp -p /a/etc/passwd /a/etc/passwd-orig
#cp -p /a/etc/shadow /a/etc/shadow-orig

v) Now stick to basic and remove the encrypted password entry for root from /a/etc/shadow file.Before Modifications:
#grep root /a/etc/shadow
root:WP7grKsEFAgt.:15182::::::

After Modifications:
#grep root /a/etc/shadow
root::15182::::::

vi)Update the boot archive as below proceeding with the reboot
#bootadm update-archive –R /a

vii)Reboot the server
#init 6

For x86

The same procedure is followed for x86 only difference , “failsafe” session is selected  from GRUB menu. The GRUB is picking the entry from /boot/grub/menu.lst

4 comments:

  1. Hi,

    im curious about these:

    For SPARC

    i)Bring the server to OK prompt
    #init 0

    How can we got #-prompt from inaccessible or lost forgotten root password system, to be able to 'write' the "init 0" command?

    thank you for you enlightment

    ReplyDelete