Operating System - HP-UX
1830939 Members
2665 Online
110017 Solutions
New Discussion

Re: 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
Sushil Singh_1
Advisor

Re: Problem with /etc/password

Hi Sean,
We didn't realise that we made a typogrphical mistake in the passwd file. Once we logged out, we were not able to login. It is true that we should not edit /etc/passwd file.

Kapil,
ur theory sounds very good that we should use link. Unfortunately, I don't think the ln command is available in a single user mode. But I would confirm it,

Thanks
steven Burgess_2
Honored Contributor

Re: Problem with /etc/password

Hi

If you do require to for a reason edit the /etc/passwd file then use vipw this will lock the password file to stop any discrepencies.

To check the passwd for for inconsistency use

pwck

Can't remember whether /usr is mounted in single user mode (don't think it is)

Just mount it (if not) then you can use ln command.

HTH

Steve

take your time and think things through
Rajasekhar Raman
Frequent Advisor

Re: Problem with /etc/password

Sushil,

To be safe that this does not occur in the future, make sure all the legitimate shells are included in the /etc/shells file. Do a man on "shells" to get more info. Sometimes a shell you think is legitimate may not be included in /etc/shells, and if it does not exist, you will may run into this problem. And finally it always helps to make sure that the shell you have assigned to any user does indeed exist.
Sanjay_6
Honored Contributor

Re: Problem with /etc/password

Hi Sushil,

Maybe this link can help. This is the recovery procedure for 10.20, but the same sort of guidelines can be followed for 11.0. The cd to be used under 11.0 would be the core install cd.

http://support1.itrc.hp.com/service/cki/docDisplay.do?docLocale=en_US&docId=200000047869320

The doc id is OZBEKBRC00000581

Also try this pdf from the cookbook,

http://us-support2.external.hp.com/iv/data/documents/DE_SW_UX_swrec_EN_01_E/SystemRecovery.pdf

Hope this helps.

Regds
Martin Johnson
Honored Contributor

Re: Problem with /etc/password

/usr is NOT mounted when you boot in single user mode. That is why you need to boot in single user mode to extend /usr (when it is a HFS file system).

HTH
Marty
Sushil Singh_1
Advisor

Re: Problem with /etc/password

Thanks you all,
I got to learn a lot from all ur suggestions.

Sean OB_1
Honored Contributor

Re: Problem with /etc/password

Sushil,

Just a reminder to give points out to those who answered your questions. It only takes a moment, and helps make the forums more useful to everyone.

Sean