Solaris 11Oracle SolarisSolaris 11.3Solaris 11.4

How to reset root password in Solaris 11

In this tutorial, we will learn how to reset root password in Solaris 11 operating system which you may have forgotten.

Steps Involved to reset root password:

If you forget the root password and you cannot log into the system, you will have to do the following:

  • Boot from the Oracle Solaris media.
  • Import the root pool.
  • Mount the boot environment.
  • Remove the root password from the /etc/shadow file.
  • Change PASSREQ option to ‘no’ in file (etc/default/login)
  • Reboot the system to single user mode.
  • Log in and set root’s password.
  • Change back PASSREQ option to ‘yes’ in file (/a/etc/default/login)

Step 1: Boot from the Oracle Solaris media 

Stop and bring the system to OK prompt (SPARC) or BIOS (x86) and Boot from the Oracle Solaris media(installation media or from the network), then select the Shell option (option 3).

Now you should get the command prompt.

oracle solaris installation menu -
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 -
boot environments list

As we can see we have two boot environments but here be named solaris-1 is currently active on reboot. So we will consider it (solaris-1) in next step.

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. Set the TERM type.

# TERM=vt100
# export TERM

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

root shadow entry -
root shadow entry
# cd /a/etc
# vi shadow
# cd /

Make sure root password entry is deleted from shadow file.

# cat shadow | grep root
root shadow entry deleted -

c. 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)

# cd default
# vi login
PASSREQ in login -
PASSREQ in login file

Step 4: Update the boot archive. 

# bootadm update-archive -R /a

Step 5: Unmount the boot environment. 

Unmount the boot environment (in our case it is solaris-1).

# beadm umount solaris-1

Step 6: Reboot the system to single user mode. 

a. Halt the system.

# halt

b. Reboot the system to a single-user state, and when prompted for the root password, press Return.

If you don’t know how to reboot the Solaris system to a single user mode check guide “How to Boot a Solaris System to a Single-User State (Run Level S)“.

Step 7: Reset the root password.

# passwd -r files root
New Password: xxxxxx
Re-enter new Password: xxxxxx
passwd: password successfully changed for root

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

Press Control-D to reboot the system.

Now we will be able to login with root user with the password you set.

Reference Links:-

5 2 votes
Article Rating

Prashanth Nimesh

I'm Prashanth Nimesh, a System Administrator with over 5 years of experience in the IT field and a B.Tech in Computer Science. My passion for technology and problem-solving led me to create The Geeks Hub, where I share my expertise in Linux, Solaris, and server management. As the main contributor, I aim to simplify complex tech topics and provide practical guides to help IT professionals and enthusiasts navigate the digital landscape with confidence.

Related Articles

Subscribe
Notify of
guest
1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
trackback

[…] Booting a system into different run levels solves certain problems. For example, if a system fails to boot due to a damagedĀ configurationĀ file, refuses to allow the user to log in due to a corrupted /etc/passwd file or if you forget your password, you can solve these problems by booting into single-user mode. You may check out our post How to reset root password in Solaris 11. […]

Back to top button