Recover Solaris Root Password

If you lost or forgotten the root password of Solaris operating system – You can do the following steps to recover back the password!

1. Go to ok prompt.

2. At the ok prompt, boot cdrom into single user mode.

ok boot cdrom -s

3. Mount the root partition.

# mount /dev/dsk/c0t1d0s0 /tmp

Additional note:
In this example, we use cot1d0s0 as root partition. Please note the root partition since we are going to change the password in root. If you cannot find the root partition, use:

# ls /tmp/dev/dsk

4. Open & edit /etc/shadow file.

# vi /tmp/etc/shadow

5. Find the root line & delete the root password & save.

root:YsTNdYkImLuVy:46732::::::

Additional note:
Delete only between : to : & the file will be like this:

root::46732:::::::::

6. Unmount root partition.

# umount /tmp

7. Reboot the system.

# reboot

8. Hit <enter> when prompted for root password. Once get into shell, set root password.

# passwd

Additional note:
If you received any error messages while loading the partitions, try to fsck the partition:

# fsck -y /dev/dsk/c0t1d0s0

You May Also Like

Leave a Reply?