1834480 Members
3548 Online
110067 Solutions
New Discussion

Re: passwd command

 
Tammy Liang
Regular Advisor

passwd command

passwd command chop home and shell information in /etc/passwd file, cuase user(s) can not log in due to "NO SHELL".

Thanks for any help and reply.

Tammy
take easy, enjoy life
20 REPLIES 20
A. Clay Stephenson
Acclaimed Contributor

Re: passwd command

The passwd command did not do this. All you need to do is edit /etc/passwd using vi and insert the home and sh values for the users.

It would help if you explained how this happened --- and I'm sure that you made backup copies of /etc/passwd and the tcb database (if applicable) before any scripts were run.
If it ain't broke, I can fix that.
Peter Godron
Honored Contributor

Re: passwd command

Tammy,
you can use vipw to edit the /etc/password or use SAM.

That is if I have understood the problem correctly. If not, can you please give more details.
Tammy Liang
Regular Advisor

Re: passwd command

I have been running passwd command to change users' password w/o issue.

This is the first time that I see passwd command remove users' home directory and log in shell in /etc/passwd file.

I agree passwd command should not remove users' home directory and log in shell. But it does indeed happen to one of our hpux systems.
I even run check sum on /usr/bin/passwd with other working system. The numbers are the same...
take easy, enjoy life
Patrick Wallek
Honored Contributor

Re: passwd command

On the system with problems -- are you doing a '/usr/bin/passwd' or are you just typing 'passwd' at the prompt? If you have just been using 'passwd' try explicitly using /usr/bin/passwd. Also, if you were using 'passwd' only, do a 'whence -v passwd' to see what command is actually run.

If it does not say 'passwd is /usr/bin/passwd' and instead gives some other path or script name, then you need to investigate that.

Tammy Liang
Regular Advisor

Re: passwd command

I run /usr/bin/passwd with same result.
Below are the last 2 lines after I run /usr/bin/passwd

a135212:RRISoffAhbh8.:108:0::21:Morris~Wen,,,
a324683:L0.MuP7a2bM4.:107:0::21:Agus Soejono

Tks...
take easy, enjoy life
Patrick Wallek
Honored Contributor

Re: passwd command

Fix those 2 lines and then try running a pwck and see what it returns. It appears that those 2 lines are not correct.

a135212:RRISoffAhbh8.:108:0::21:Morris~Wen,,,
a324683:L0.MuP7a2bM4.:107:0::21:Agus Soejono

The format of the lines should be:

user:password:uid:gid:Comments:/home/dir:/usr/bin/sh

The 2 lines you mention have the requisite number of fields, but the last 2 are wrong.

The '21' is where the home dir should be and the names are where the shell should be.

Let pwck check the password file, fix any errors it reports and try again.
Tammy Liang
Regular Advisor

Re: passwd command

It is not only last 2 lines in /etc/passwd.
It is for all users in /etc/passwd file after I run /usr/bin/passwd. I just post the last 2 lines....
take easy, enjoy life
Patrick Wallek
Honored Contributor

Re: passwd command

Have you run pwck on the /etc/passwd file? That is the first thing to do.

Fix the problems that it mentions and then see what happens from there.
Tammy Liang
Regular Advisor

Re: passwd command

After run pwck and passwd again, still has the same result of /etc/passwd. The home directories and log in shell are gone....
take easy, enjoy life
A. Clay Stephenson
Acclaimed Contributor

Re: passwd command

pwck does not repair any damage. You must do that manually using vi and repeat until pwck is clean. The entire file must be clean or unpredictable results can occur.

If it ain't broke, I can fix that.
Tammy Liang
Regular Advisor

Re: passwd command

The /etc/passwd is correct, after I copy from good /etc/passwd. The problem is the /usr/bin/passwd command chop home directory and log in shell in /etc/passwd file, after I run passwd to change password.

/usr/bin/passwd is not working correctly....
take easy, enjoy life
Patrick Wallek
Honored Contributor

Re: passwd command

I would like to see screen shots, or cut-and-paste output of:

1) The /etc/passwd file BEFORE you execute the passwd command.

2) The command line you are using when running passwd and any output (I don't care about the password you are actually typing in).

3) The /etc/passwd file AFTER you execute the passwd command.

Also, what version of HP-UX are you running?
Tammy Liang
Regular Advisor

Re: passwd command

HPUX 11.11

Before run passwd.

a135212:RRISoffAhbh8.:108:21:Morris~Wen,,,:/home/a135212:/usr/bin/sh
a324683:kGy1op4KBYcoA:107:21:Agus Soejono:/home/a324683:/sbin/sh
server1 /etc #

Now run /usr/bin/passwd

server1 /etc # /usr/bin/passwd a324683
Changing password for a324683
New password:
Re-enter new password:
Passwd successfully changed

After run /usr/bin/passwd

a135212:RRISoffAhbh8.:108:0::21:Morris~Wen,,,
a324683:B9RrfWdZ6kLCU:107:0::21:Agus Soejono
$
take easy, enjoy life
A. Clay Stephenson
Acclaimed Contributor

Re: passwd command

Patch PHCO_35250 does appear as though it could fix this; you must also install the dependencies.
If it ain't broke, I can fix that.
Patrick Wallek
Honored Contributor

Re: passwd command

OK, this is officially very very strange.

Do you have the latest passwd cumulative patch, PHCO_33214, loaded? If not you may try it.

http://www2.itrc.hp.com/service/patch/patchDetail.do?patchid=PHCO_33214&sel={hpux:11.11,}&BC=main|search|

What is the output of:

# what /usr/bin/passwd
Tammy Liang
Regular Advisor

Re: passwd command

$ what /usr/bin/passwd
/usr/bin/passwd:
$Revision: @(#) all CUP11.11_BL2003_0517_1 PATCH_11.11 PHCO_29125
Sat May 17 15:42:02 PDT 2003 $
$

I ran check sum on /usr/bin/passwd and compare with other systems that has no problem. The check sum number comes out the same...

I think passwd works before.

Tks.
take easy, enjoy life
Patrick Wallek
Honored Contributor

Re: passwd command

I would still suggest loading the latest passwd patch and the patch that Clay recommends. It may be that there is something unique on this server that is causing you a problem.

Are you using any sort of other directory service, like LDAP, NIS, NIS+, etc.?
A. Clay Stephenson
Acclaimed Contributor

Re: passwd command

The cksum only means that part of the executable is the same; you have done nothing about shared libraries and that is what the patch I suggested does. Whatever you do, do start moving shared libraries across machines or you will have the IDB incredibly bogusified.
If it ain't broke, I can fix that.
A. Clay Stephenson
Acclaimed Contributor

Re: passwd command

Ooops, I'm stupid: That should be "DON'T START MOVING SHARED LIBRARIES".
If it ain't broke, I can fix that.
Dennis Handly
Acclaimed Contributor

Re: passwd command

>Clay: have the IDB incredibly bogusified.

(That's IPD.)

Tammy could also use swverify to check to see if there are other files that have been messed up.

(Unfortunately this may show up false issues due to sloppy packaging processes.)