Showing results for 
Search instead for 
Did you mean: 

change passwd using script

Go to solution
Occasional Advisor

change passwd using script

Hi All,

I am trying to use a shell script to change the passwd of users in hpux 11.11 and 11.23 box.I am using usermod.sam `echo "newpasswd001"/usr/lib/makekey" userid,I didn't get any error but when I try to loging using the new passwd I am getting access denied error.

Does anyone knows whats happening?
Honored Contributor

Re: change passwd using script

Your usermod.sam command has unbalanced quotes and other errors. It looks like it would not work at all as posted.

Please show the command line you used *exactly*: errors make it harder to figure out what is happening. Please remember that we, the forum readers, know only exactly the facts you're telling us, and nothing more.

The makekey utility takes an input of exactly 10 characters, of which the first 8 characters will be the new password. Your "newpasswd001" has 12 characters. At least on HP-UX 11.23, the extra characters seem to be ignored.

Effectively, you now have userid's password set to "newpassw" using the salt value "d0".

Please see this thread:

It contains a small perl script for creating passwords of length 1-8 characters. For passwords with 9 or more characters, you would need something that uses the bigcrypt(3C) function instead of the classic Unix crypt(3C) as used by "makekey" and JRF's perl script.

Attached is bigpw.c, a small C program (written by adapting a pw.c I found somewhere, most likely from this forum). It can be compiled using the default HP-UX K&R C compiler: run "cc -o bigpw bigpw.c -lsec" to compile it, then copy "bigpw" to /usr/local/bin or wherever you want it.

With bigpw, you should be able to set 9-character or longer passwords:

/usr/lbin/usermod.sam -p $(/usr/local/bin/bigpw 'newpasswd001') userid


Occasional Advisor

Re: change passwd using script

The solution worked for me.Thank you Matti
Regular Visitor

Re: change passwd using script

it works! thank you.