Cannot recover root passwd through serial console mode by using CDROM

hi
i cant recovery root passwd through serial console mode by using CDROM.. i tried following step but no luck

in ok prompt :
ok boot cdrom -s it comes single user mode

i check format cmd it showing disk
c1t0d0
c1t2d0 then
#mount /dev/dsk/c1t0d0s0 /a
#cd /a
# vi /etc/shadow ( it showing following )
root:NP:6445:::::::::
i removed NP and save
#reboot
it asking root passwd again after reboot

help me .. how to solve this issue

Are you sure you are editing right file? vi /etc/shadow should be vi /a/etc/shadow . When it is asking for password did you try just hitting Enter?

1 Like

NP means "no password". That should have given you a hint you were not editing the right file ...

yes, i know NP means no passwd .. i just tried removed .. it asking username and passwd .. i cant login to the machine ....

how to solve this issue .. plz help me

Did you try bartus11 suggestions ? (editing the correct file and typing the enter key when prompted for a password)

1 Like
 ok boot cdrom -s
# mount /dev/dsk/c1t0d0s0 /a
# TERM=sun; export TERM
# vi /a/etc/shadow

from your file you said you have root as:
root:NP:6445:::::::::
and you removed NP and left:
root::6445:::::::::

# vi /a/etc/shadow 
remove NP and 6445 they are associated to each other.
Now you should have: 
root:::::::::::

save and exit the file 
# cd /; umount /a
# init 6 

And you are done. When it reboots, enter the root login name hit enter.
You will be logged in and then you can change the root password.

 # passwd root

@cjashu : Why do you think removing the date of the last root password change would affect the OP issue ?

@ jlliagre When you say date, what are you referring to?

---------- Post updated at 06:32 PM ---------- Previous update was at 06:26 PM ----------

@jlliagre I believe you are referring to 6445 as the date? I faced this same issue before and by experimenting with it I figure out the problem of the root password not being recovered. First when I was studying...all what I read was to remove the entire root entry. I did this and I had a nightmare. Finally I figured I had to remove only the encrypted portion of the root password. I did that and left 6445. Rebooted the OS and it came to login prompt. Logged in with root and hit entered. Password was still required. I went into the file again and deleted 6445 leaving root:::::::::::::: and it did work.
So I learned the had way after having a headache. Go ahead you can try it yourself and see what happens.

I'm afraid that doesn't make sense. I certainly can login without providing a password with an empty password field and 6445 as the last login date, i.e. with:

root::6445:::::::::

in /etc/shadow.

Note that 6445 is the default last login date on Solaris and represent Aug 25 1987, an early Solaris 2.0 beta release.

@jlliagre Well if thats the case then you should try it and let me know the out come because I tried it and it never worked. So what do you think is the problem? By the way lets see if coolboys fix the problem with my solution.

I don't recall the O/P mentioning the version of Solaris. In my old SunOS notes I notice that I had to issue the pwconv command after manually editing /etc/passwd or /etc/shadow , and before issuing passwd root .

Hope this helps.

Ps. If you have to edit the current active /etc/passwd file use vipw not vi .

As I wrote, I already did and it worked as expected.

One possible cause for the OP problem (and possibly an explanation for your experiment) would be a corrupted /etc/shadow file. An empty line at the beginning of this file is sufficient to prevent logins. See that post.

I've been following this thread and can't add much more technically. The method being suggested should work fine.

From my experience removing the encrypted password from /etc/shadow is all that is required to clear a password.

Coolboys do take special note of jilliagre's post regarding a blank line at the start of /etc/password or /etc/shadow causing this problem. DOUBLE CHECK FOR THAT!!

Otherwise, are you absolutely sure that the harddisk root filesystem that you mounted and edited (removing the encrypted password) IS the same one you are booting from???

Thanks, Bartus11,jlliagre...
problem resolved ....

i tried vi /a/etc/shadow (it showing encrpt passwd) and removed

i set new root passwd after reboot ..
problem resolved ....

thank you very much bartus11,jlliagre and cjashu

---------- Post updated at 12:26 AM ---------- Previous update was at 12:24 AM ----------

thanks very much

---------- Post updated at 12:27 AM ---------- Previous update was at 12:26 AM ----------

thank you very much