1848571 Members
7093 Online
104033 Solutions
New Discussion

Re: shell

 
lamy_1
New Member

shell

when i am connected with login root , the system answers: no shell,
in fact in the /etc/passwd root has /sbin/ksh as shell
but /sbin/ksh does not exist
how to force a shell with "su"
thanks
tex
6 REPLIES 6
Joseph C. Denman
Honored Contributor

Re: shell

change it to /sbin/sh for the born shell
If I had only read the instructions first??
Bruce Regittko_1
Esteemed Contributor

Re: shell

Hi,

Root's shell should always be /sbin/sh, which is the POSIX shell. The su command will always read /etc/passwd for the shell to launch so that will not help you.

To fix /etc/passwd, you will have to boot to single user mode, which won't ask you for a root password, and then edit /etc/passwd with vi. If your's is a trusted system, you will need to get a fresh /etc/passwd from either a recovery tape or from the installation cd.

--Bruce
www.stratech.com/training
James R. Ferguson
Acclaimed Contributor

Re: shell

Hi:

Root's shell should ALWAYS be /sbin/sh in /etc/passwd. This is the POSIX shell -- a superset of the ksh (Korn). Notice that the path is /sbin and not /usr. /usr isn't mounted during initial startup sequences.

The ksh shell is found in /usr/bin/.

...JRF...
Dan Hetzel
Honored Contributor

Re: shell

Hi Lamy,

Root shell should always be /sbin/sh, it has been said before.

The reasons for this are the following:
- all other shell reside in /usr/bin and that directory isn't mounted when you boot single user and ...
- /sbin/sh is an statically linked executable while other shells rely on dynamic libraries (located in /usr/lib)

The second point prevents you from copying another shell to /sbin at the libraries are only available when /usr is mounted.

You may change the entry in /etc/passwd if you log-in as a user and do a 'su' (not 'su -').
This will allow you to use 'vipw' to edit the password file.

Best regards,

Dan
Everybody knows at least one thing worth sharing -- mailto:dan.hetzel@wildcroft.com
Carlos Fernandez Riera
Honored Contributor
Carlos Fernandez Riera
Honored Contributor

Re: shell

From man passwd:

The login shell for the root user (uid 0) must be /sbin/sh. Other
shells such as sh, ksh, and csh are all located under the /usr
directory which may not be mounted during earlier stages of the bootup

Hewlett-Packard Company - 3 - HP-UX Release 10.20: July 1996

passwd(4) passwd(4)

process. Changing the login shell of the root user to a value other
than /sbin/sh may result in a non-functional system.
unsupported