Bad or Non-Existent Root Shell - Solaris

24 October 1997
So you set the shell for root to something that doesn't exist, eh?

You're screwed. Get the Solaris CD and boot from it in single user mode.

Before you shutdown, check your partitions like this

	df -k
You want to find out what partition has /etc/passwd
	ok boot cdrom -sw
Then you need to mount the partition that has /etc/passwd and edit it. Hopefully you did the step above to find out what partition it is on before you rebooted, but it is probably something like.
	mount /dev/dsk/c0t0d0s0 /mnt
This will mount partition 0 on scsi device 0 at /mnt

Then you can edit the passwd file using sed (sorry, vi and emacs aren't on the boot cdrom)

You can see the passwd file using cat

	cat passwd

	sed s/badpath/goodpath/ passwd > passwd2
Replace "badpath" and "goodpath" with the parts of the path that were wrong in your shell specification. I did this My passwd file said
	root:x:0:1:Super-User:/:/sbin/tcsh
When it should have said
	root:x:0:1:Super-User:/:/sbin/sh
So I did this to fix it.
	sed /tcsh/sh/ passwd > passwd2
	mv passwd2 passwd
	cat passwd
That's it. Good luck.

Return to Gene's Home Page
Return to Gene's Random Unix Crap