MYSYSAD.COM

Remove the UNIX root Password

· Solaris & Sun · Files & disks · Users & security

From time to time, passwords are lost or forgotten - even root's password. One way of removing the root password is to boot to single user mode from an installation cdrom. Mount the root, /, partition and blank out the encrypted password field in the shadow file. Here's an illustration.

ok boot cdrom -s

# mount /dev/dsk/c0t0d0s0 /mnt

# more /mnt/etc/shadow
root:9Zpah2q.zd.JJu:13832::::::
daemon:NP:6445::::::
bin:NP:6445::::::
sys:NP:6445::::::
adm:NP:6445::::::
lp:NP:6445::::::
uucp:NP:6445::::::
...

# vi /mnt/etc/shadow
root:BLANK THIS FIELD OUT:13832::::::
daemon:NP:6445::::::
bin:NP:6445::::::
sys:NP:6445::::::
adm:NP:6445::::::
lp:NP:6445::::::
uucp:NP:6445::::::
...
:wq!

# cd /
# umount /mnt
# reboot -- -s

Change the root password in single user mode (don't need to add "root" but I do it for clarification.
# passwd root
passwd: Changing password for root
New password:
Re-enter new password:
passwd (SYSTEM): passwd successfully changed for root