How to reset root password in Solaris 11.2

Step 1: Boot from the Oracle Solaris media.

oracle-solaris-installation-menu

Step 2: Import the root pool.

Import the root pool, Mostly the pool name for root file system is rpool.

zpool import -f rpool

Step 3: Mount the boot environment.

a. Create a mount point for the boot environment.

mkdir /a

b. Check for the boot environments available.

beadm list

solaris-beadm-list

c. Mount the boot environment(in our case solaris-1) on the mount point /a.

beadm mount solaris-1 /a

Step 3: Remove the root password from the /etc/shadow file.

a. Edit the shadow file and clear all text between the first colon (😃 and second colon(😃. This text is the encrypted password for root.

vi /a/etc/shadow
grep root /a/etc/shadow

root-shadow-entry-deleted

b. By default, Solaris doesn’t allow empty password, for this the workaround is to Change the ‘PASSREQ’ option to ‘no’ in file (etc/default/login)

grep '^PASSREQ' /etc/default/login
sed -n '/^PASSREQ/s/YES/NO/p' /etc/default/login

PASSREQ-in-login

Step 4: Update the boot archive.

bootadm update-archive -R /a

Step 5: Unmount the boot environment.

beadm umount solaris-1

halt

Step 6: Reboot the system to single user mode.

After reboot, on grub meue press e to modify, and append -s in line $kern.

modify-grub-menu

Press Ctrl-x to boot.

Step 7: Reset the root password.

passwd -r files root

After changing the root password, change back the ‘PASSREQ’ option to ‘YES’ in file (etc/default/login).

sed -n '/^PASSREQ/s/NO/YES/p' /etc/default/login