1837149 Members
2140 Online
110112 Solutions
New Discussion

Re: root: no shell

 
SOLVED
Go to solution
Damiano Angelo
Occasional Advisor

root: no shell

We can't login with root user because in the passwd file there is a wrong shell specification:
root:/y.QL0TL6uJH.:0:3::/:/sbin/ksh
(/sbin/ksh doesn't exist).

trying to login we receive the following message: "no shell"

We have:
/etc/passwd -r--r--r-- 1 root sys
/etc dr-xr-xr-x 33 bin bin
/sbin dr-xr-xr-x 13 bin bin

We cannot login using bin or adm or sys users because system asks for password we don't know.

It seems to be only root user with 'root' privileges.

Is there a method to bypass the problem or to have root privileges with a another user???

Thanks.
8 REPLIES 8
G. Vrijhoeven
Honored Contributor

Re: root: no shell

Hi,

What you can do is login as normal user and su to root ( without - ). If this does not work you could try restoring a backup of /etc/passwd with the correct shell, become root and put back the original shell.

Gideon
MarkSyder
Honored Contributor
Solution

Re: root: no shell

If you boot into single user mode you should be able to edit the /etc/passwd file and change ksh to sh.

Instructions for accessing single user mode differ for different OS versions, so if you don't know what to do let us know more details about your system.

Mark Syder (like the drink but spelt different)
The triumph of evil requires only that good men do nothing
Franky_1
Respected Contributor

Re: root: no shell

Hi,

if you boot into single user mode (interrupt boot process, boot pri, hpux -is (boot)then you should be able to change the entry in /etc/passwd from ksh to sh.

HTH
Don't worry be happy
Marc Roger
Advisor

Re: root: no shell

To avoid this kind of problems in the future, it's better to use commands such as chsh/chfn/passwd rather than editing the /etc/passwd directly.
G. Vrijhoeven
Honored Contributor

Re: root: no shell

Hi,

I addition to Makrs command, you could use vipw in the future for editing the passwd file. It also checks the result.

Gideon
Damiano Angelo
Occasional Advisor

Re: root: no shell

We fixed the problem rebooting in single user mode and temporarily changing the passwd permission bits, allowing passwd modification.
We entered as normal user in init 3 running level and supplied right shell value in passwd.
Then re-rebooted the system normally.
We do apologise for our english and thanks a lot for your help.
Fabio Ettore
Honored Contributor

Re: root: no shell

Ciao Damiano,

dato che i ragazzi dell'ITRC ti hanno aiutato e suggerito come risolvere il problema potresti assegnare loro dei punti?
Benvenuto nei forum di ITRC! ;-)

Buona giornata!
Ettore

P.S.: Perfavore non assegnare punti a questo mio post...

Translate in English:
since ITRC guys gave you suggestions about how to solve the problem, could you assign them points?
Welcome in ITRC forum!

Have a nice day!
Ettore

P.S.: please no point for me in this post...
WISH? IMPROVEMENT!
Bill Hassell
Honored Contributor

Re: root: no shell

Very important: don't change root's shell. /sbin/sh is *NOT* the Bourne shell like other versions of Unix. It is the POSIX shell, a superset of ksh. So the features that you like in ksh (and BASH, both are POSIX standard) are found in /sbin/sh (and for ordinary users, /usr/bin/sh).


Bill Hassell, sysadmin