Operating System - HP-UX
1753974 Members
7262 Online
108811 Solutions
New Discussion юеВ

Problem with /etc/password

 
Sushil Singh_1
Advisor

Problem with /etc/password

Hi All,
I am not able log into HP machine because I changed the login shell for root from /bin/sh to /bin/ksh in /etc/password file. Now I m not able to login in to the machine. I get the following message. Please help me to recover.

Local flow control on
Telnet TERMINAL-SPEED option ON

HP-UX ozzie B.11.00 U 9000/800 (ta)

login: root
Password:
Please wait...checking for disk quotas
No shell
Connection closed by foreign host.
16 REPLIES 16
A. Clay Stephenson
Acclaimed Contributor

Re: Problem with /etc/password

You have now learned a valuable lesson. Leave root's password as /sbin/sh. You must have a statically linked version.

You will need to boot from your recovery media and mount / as /root and edit /root/etc/passwd.
If it ain't broke, I can fix that.
Kelli Ward
Trusted Contributor

Re: Problem with /etc/password

Hi,
Do you have another user at UID 0?
If so, you can repair that way by logging in as an alternate admin.
If your not sure, log in as a regular user and more /etc/passwd to see if there is another user at UID 0. If so, your on your way to being in.
Note - Be very careful and mindful of multiple admin accounts as they can lead to trouble.

Good luck,
Kel
The more I learn, the more I realize how much more I have to learn. Isn't it GREAT!
Jeff Schussele
Honored Contributor

Re: Problem with /etc/password

Hi Sushil,

One other thing to try IF you have another HP-UX system with access to a root account

1) Login to the other system as or become root
2) ftp to the original system - as root
ftp> cd /etc
ftp> lcd /etc
ftp> rename passwd passwd.bad
ftp> bin
ftp> put passwd

Then try to login to the original system. If you get in edit the passwd.bad BACK to proper shell, rename the "temp" passwd file to passwd.tmp & the original back to passwd.

It's a good idea to keep a safe backup copy of the passwd & group files somewhere on the system & cron it to copy it out at least once a week - even more if the file changes frequently.

Rgds,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
harry d brown jr
Honored Contributor

Re: Problem with /etc/password

(1) shutdown - probably a hard shutdown (power off)

(2) boot (power on)

(3) interrupt boot cycle and boot from your normal boot device BUT say "Y" to interact with ISL

(4) then enter

hpux -is

(5) then when in single user mode

fsck
mount -a

(6) then fix /etc/passwd

then reboot

live free or die
harry
Live Free or Die
Sridhar Bhaskarla
Honored Contributor

Re: Problem with /etc/password

Well.. when you reboot (hard boot) the box next time (not necessarily in single user mode), it will automatically put you in single user mode advising you to fix the root's shell. You can edit /etc/passwd file and put back /sbin/sh.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Sushil Singh_1
Advisor

Re: Problem with /etc/password

Hi all,
Thanks for all ur replys. I tried all the option

Mr Stephenson,
I did bootup from recovery media
but and we to the maintenance shell, but u cannot mount any thing in maitenance shell.

Hi Kelli,
Unfortuantely, I didn't have any user with UID 0.

Hi Jeff,
I tried ftp, but login would fail as soon as u type root as a user.

Hi Harry,
Your solution was right on the money. I followed exactly and got the problems fix.

Hi Sridhar,
Only the root shell was wrong, therefore the system would never come to single user mode unless and until we bring it up to single user mode. I was able to loggin as a different log

Thanks u all

Sean OB_1
Honored Contributor

Re: Problem with /etc/password

Ah, a mistake I've made in the past too!

Something to remember, any time you make a change to the root entry of the password file make sure to su to root and make sure it works.

That way if it doesn't, your still logged in as root and can fix the problem.

KapilRaj
Honored Contributor

Re: Problem with /etc/password

guys,

hv you tried "switch user" , i mean login as another user & do an

$ su

Kapil Raj
Nothing is impossible
KapilRaj
Honored Contributor

Re: Problem with /etc/password

try one more R&D not sure abt the problems after that ,

mv /bin/ksh /bin/ksh.old (backup)
ln /bin/sh /bin/ksh
once u r able to login remove the link & restore actual /bin/ksh from the back up copy


Kapil Raj
Nothing is impossible