Reset Root Password on Solaris

In order to reset root password on Solaris box, you would need to do the following :

  1. Go to OK Prompt by:
  2. <stop> + <a>

    or

    # init 0

  3. Once you got the OK prompt, boot into single user mode:
  4. OK> boot cdrom -s

  5. Mount the root directory, On a typical system, it’s probably c0t0d0s0 or c0t0d0s1:
  6. # mount /dev/dsk/c0t0d0s1 /

  7. Make a copy of /etc/shadow.
  8. # cp /etc/shadow /etc/shadow.backupcopy

  9. Edit /etc/shadow file
  10. # vi /etc/shadow

    Your /etc/shadow should look like this:
    root:<password>::877667

  11. Delete the password of the root user (Leave the second field empty, dont change anything else):
  12. root:<password>::877667

    edit to

    root:::877667

  13. Reboot the box
  14. Login to root account with no password.

3 Responses to “Reset Root Password on Solaris”

  1. Rizal Says:

    Wow. So does this mean that anyone with physical access to a Sun box would be able to reset the root password?

    [Reply]

  2. anilezfa Says:

    yup .. provided they have the cd/dvd as well.. it’s not only unix even in windows if you got the physical access you can reset the administrator password :-D

    [Reply]

  3. Rizal Says:

    I guess you’re right.

    Anyway, an easy way to never forget your root password is to just set it to be “root”. Ha ha ha!

    [Reply]

Leave a Reply