Link to home
Start Free TrialLog in
Avatar of MongolianNoseFlute
MongolianNoseFluteFlag for Ireland

asked on

trying to change solaris root password using single user shell - not working

hi - the root password has been lost on a fairly important box in my company. i have tried to chagne as per below method but cant - it mentions the file is read only. am i missing something?

When you boot from the CD, select the option for the Sigle-user mode (Option 6 on Solaris 10 CD)

This will look for the currently installed Solaris OS on your system and prompts a Yes/No question to mount the Root filesystem as a Read/Write file system onto /a.

Select yes to mount the root file system (/dev/dsk/c0t0d0s0 here) on /a. If you select No, no harm as you still can mount it manually using:

mount /dev/dsk/c0t0d0s0 /a

NOTE: /a is a temporary mount point that is available when you boot from CD or a JumpStart server

Now, with the root file system mounted on /a. All you need to do is to edit the shadow file and remove the encrypted password for root.

# vi /a/etc/shadow

Now, exit the mounted filesysten, unmount the root filesystem and reboot the system to single-user mode booting of the disk.

# cd /

# umount /a

# init s
20150508-155852.jpg
ASKER CERTIFIED SOLUTION
Avatar of woolmilkporc
woolmilkporc
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of MongolianNoseFlute

ASKER

Thanks - I tried that but it returned the error below:
TERM=vt100 is not an identifier
ok - we used another method and i see a string next to root:

$asdf.1AH.MJ3sivd4$YFoFnasdf4cZW9H6G6cbT4.1VBmasdfmv.a0wCU/i3zEFasdfasdf4W.:15843:0:99999:7:::

do i remove everything after root: or leave some of it?
Remove everything after "root:"  up to the next colon (:), leaving both colons intact.
The result should look like

root::15843:0:99999:7:::  

Strange thing that "export" should not have worked. You have ksh (or bash), don't you? I was rather sure that "ksh" is Solaris' default shell.

Anyway

setenv TERM vt100

should have been worth a try.
If somehow you can't set the terminal, you can look up instructions on how to use the ed line editor.  https://www.gnu.org/software/ed/manual/ed_manual.html
Try this in command line:
ok> boot cdrom -s
# mount /dev/dsk/c0t0d0s0 /a
# TERM=xterm; export TERM
# /usr/openwin/bin/resize
# vi /a/etc/shadow
.......
Been a while but try editing a copy then overwrite e.g.

cp /a/etc/shadow /tmp/shadow
chmod +w /tmp/shadow
vi /tmp/shadow
...
cat /tmp/shadow >  /a/etc/shadow

Open in new window