Friday, December 13, 2013

Root Password Recovery for any Solaris 10 (without CD/DVD).


  1. We can recover the root password for any solaris10 without any CD/DVD, for that first we need to bring the server at OK promt
#init 0
  1. Boot the server into failsafe mode. In failsafe mode, server will boot with RAM disk without any CD/DVD
Ok>boot -F failsafe
#df -k
/ramdisk-root:a   201463  178943    2374    99%  / > Server booted from RAM
Note: Sometimes (every time is X-86 servers) the Failsafe mode will ask you to mount the root disk before giving you the Shell prompt. Do not mount at that time, just say No everywhere and bring the failsafe mode at Shell Prompt and then do the mount and update archive manually.
  1. In failsafe mode, we need to mount the server with root disk. Here my root disk c1t1d0s0
#mount /dev/dsk/c1t1d0s0 /a
#df -h|grep /a
/dev/dsk/c1t1d0s0 7.9G 7.1G 714M 92% /a


  1. Copy the configuration to enable SVM module in failsafe mode, and un mount root FS
# cp /a/kernel/drv/md.conf /kernel/drv
#umount /a
  1. Now we have to load the SVM module to enable it in failsafe mode:
#update_drv -f md
devfsadm: mkdir failed for /dev 0x1ed: Read-only file system  ßYou will see this messages
  1. Now you will be able to mount the md meta devices and will be able to make any changes
#mount /dev/md/dsk/d0 /a
  1. 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
  1. Need to remove encrypted passwd for root from /etc/shadow file
#grep root /a/etc/shadow
root:WP7grKsEFAgt.:15182::::::
#grep root /a/etc/shadow
root::15182::::::
  1. Update the boot archive as below before proceeding with the reboot.
#bootadm update-archive -R /a
Creating boot_archive for /a
updating /a/platform/sun4u/boot_archive
  1. Umount the meta device and Reboot your system, this time you are allowed to login into the server without password. Now first recommended thing would be to set you password for root.
#umount /a
#init 6

No comments:

Post a Comment