Thursday, May 19, 2005

No Shell For Root

One of the most common problems users request assistance for is the
loss of root access shortly after making changes to the roots default
shell. Users like to manually change the shell of account root to
their shell of choice. The easiest mistake to make is to change the
default shell "/sbin/sh" to "/sbin/ksh". The next time you try to
login in as root you will out that you are unable to log on as root
because there is "No shell". The only way to fix the problem is to
change root shell from /sbin/ksh to /usr/bin/ksh in /etc/passwd. Since
the /etc/passwd is owned by root and you can not log on as root any
more, how do you solve the problem ?

The problem is caused because the user does not know there are no
other shells but Bourne Shell in /sbin. Therefore the system can not
find /sbin/ksh and you fail to log on the root because of "No shell".
/sbin/sh is a hard copy under root (/) file system to make the system
usable even before the file system /usr is mounted.

Boot the System using the Solaris CD and Installation Boot Disk:

Insert the Solaris x86 CDROM in the drive
Boot with the installation diskette (or correct Driver Update Boot
diskettes)

Boot from CDROM:

Select the cdrom to boot when presented with the available devices

[ ] Disk: Target 0
[x] CD : Target 0

Press the <F2> key to continue.

Boot to Single user mode from CD:

When asked to select Interactive or Jumpstart installation type
the following:

Select type of installation: boot -s

Press the <enter> key to continue.

Note: You have approxiamately 30 seconds to make this decision
before the system boots into interactive installation.

Mount the root drive:

# mount /dev/dsk/cxdxsx /a # for IDE drives, replace x with
value that reflects your drive

or

# mount /dev/cxtxdxsx /a # for SCSI drives, replace x
with value that reflects your drive

Set your terminal mode for editing:

# TERM=at386;export TERM

Edit the passwd file and correct the path to the shell account:

# vi /a/etc/passwd

Line looks like:

root:x:0:1:Super-User:/:/sbin/ksh

When completed should look like:

root:x:0:1:Super-User:/:/usr/bin/ksh

Exit vi and save the passwd file:

:wq!

Un-mount the partition and reboot system:

# cd /
# umount /a
# init 6

1 Comments:

Blogger Ronye said...

Your are my personal JC!!

11:00 AM  

Post a Comment

<< Home