1837224 Members
2376 Online
110115 Solutions
New Discussion

/etc/passwd

 
SOLVED
Go to solution
Thomas Kopp
Occasional Advisor

/etc/passwd

Hi,
If you change the entry for the root-shell in /etc/passwd to ksh, is there a possiblity to log into the machine via root account?? ( In moment I got the error message "no shell" )
Thanks
Thomas
11 REPLIES 11
James R. Ferguson
Acclaimed Contributor

Re: /etc/passwd

Hi:

Do *NOT* change root's default shell. It should always be /sbin/sh ( the POSIX shell ).

During startup, only "/" is initially mounted, not /usr, etc. in which shells like 'ksh' live.
Furthermore, /sbin/sh is devoid of any linkages to libraries in /usr.

...JRF...
Stefan Farrelly
Honored Contributor

Re: /etc/passwd


If you change root's entry to ksh then yes, youre in trouble if you boot in single user mode as /usr is not mounted and this is where ksh lives, and the libraries needed for it.

Leave it as /sbin/sh which is statically linked so it doesnt need any libraries (and thus /usr)
Im from Palmerston North, New Zealand, but somehow ended up in London...
A. Clay Stephenson
Acclaimed Contributor

Re: /etc/passwd

I would add one other thing, whenever you are making any direct changes to the passwd file (and especially the root entry), be logged in as root in two sessions so that you can get yourself out of trouble as fast as you got yourself in.

Clay
If it ain't broke, I can fix that.
James R. Ferguson
Acclaimed Contributor

Re: /etc/passwd

Hi again:

...and I'd second Clay's comment!

Also, 'vipw' is another useful caution when editting /etc/passwd.

...JRF...
Thomas Kopp
Occasional Advisor

Re: /etc/passwd

Anyway you allare right, but now the /etc/passwd
is changed.
Is there still a way to get into the machine to change this entry back ??
Thomas
Steffi Jones_1
Esteemed Contributor
Solution

Re: /etc/passwd

Hello Thomas,

I guess you got the message that you can't change it to ksh. If you did this already and need to know a way out of this now then you have to go and boot from the support cd and move the default /etc/passwd in place. After you get the box back up you can move the old passwd file back in place and edit it back to /sbin/sh.

Unfortunally this is a situation where booting into single user mode won't help either, because it won't find the shell for that.

Good luck,

Steffi Jones
Vincenzo Restuccia
Honored Contributor

Re: /etc/passwd

boot in single user mode
Thomas Kopp
Occasional Advisor

Re: /etc/passwd

Hi Steffi,
do you mean the HP-Ux Support Plus ... CD
or the installation CD for HP-Ux 11.00.
Thanks
Thomas

John Bolene
Honored Contributor

Re: /etc/passwd

Leave root alone, don't change that shell.

Also the entry must be the first one in the file or it will not be found.

We had an admin that sorted the passwd file to make it look better and then the box went stupid.
It is always a good day when you are launching rockets! http://tripolioklahoma.org, Mostly Missiles http://mostlymissiles.com
Thierry Poels_1
Honored Contributor

Re: /etc/passwd

hi,
you don't have 2nd root user in your /etc/passwd?? Would come in handy in this situation!
good luck,
Thierry.
All unix flavours are exactly the same . . . . . . . . . . for end users anyway.
Rick Lui
New Member

Re: /etc/passwd

Hi,
I had this problem once and this is the reply from my local HP support. Never got to try it though cos I managed to restore the file from a network backup. Maybe the forum's experts can comment:

You need to boot as single user mode. To boot to single user mode, during
boot up sequence,

-interrupt the boot process within the 10 sec.
-Choose Y, to Interact with ISL
#BO PRI (or the correct path of your local primary hdd)
#hpux -is (launch hp-ux in single user mode)

#mount /usr and /var (mount the necessary file system)
#vipw (to change the shell in /etc/passwd)