Forget the root password on SunBlade


Please shareShare on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInShare on RedditDigg thisShare on StumbleUponShare on VKBuffer this page

Question :

I inadvertadly changed my root password on my SunBlade100 test computer.

Is there any way I can figure it out without having to reconfigure the whole OS.


Answer :

First ,if you know what file system is used is Solaris zfs, then you need a live distro

or rescue disk for Solaris. When you run off a live distro or rescue disk, the root

filesystem exists in memory.

Look at the output of the “mount” command by itself to see if the hard disk partitons

are mounted. If not, you will want to mount the root partition somewhere such as mount.

There are a lot of ifs here, such as whether the kernel your live distro or rescue disk

uses is able to mount the partition rw. Solaris will use different device names for


There are in /dev/ and probably end in p1 for the first partition, p2 for the second, etc.

If your disk has the fdisk program (I don’t know if solaris has its own version of this

program), running “fdisk -l” will list the partitions. You need to use the mount

command to mount the partition that has the /etc directory.

It should be on the root partition. I can’t see anyone wanting to mount it anywhere else.

Look at the /etc/passwd file. If there is a line like: “root:x:0:0:root:/root:/bin/bash” with

the second field of “x”, then the system uses shadow passwords. The password hash

is in /etc/shadow. Otherwise, you may see a lot of random characters between the first

and second colons. Look at the /etc/shadow file at the entry starting with “root”:


Delete the characters between the two colons to zero the root password.

This means you can reboot and login as root with no password. Then run “passwd”

as root to change the root password. If you have a system that doesn’t allow a null

password for root, this mean that you will not be able to login after zeroing out

the password hash in /etc/shadow.

In this case you have to copy the hash from the regular users entry and copied it for

root’s. That will allow you to log in as root using the regular user’s password and then

to run “passwd” to change it.