Re: Using Makekey and Usermod.sam (806 Views)
Reply
Occasional Visitor
Pete H_1
Posts: 4
Registered: ‎06-02-2009
Message 1 of 8 (1,297 Views)

Using Makekey and Usermod.sam

I'm trying to create a script that I can use to change a users' password using command line arguements. I was using makekey to generate an encrypted password, but I'm running into problems with some of the encrypted passwords. When makekey returns something like the following is works:

# echo passwillaa | /usr/lib/makekey
aadfnZyCsuaF.

but other times it will return something with like the following.
x
3RmwumSorhg

I was taking the encrypted password and using it in the usermod.sam command as follows:

/usr/sam/lbin/usermod.sam -F -p `echo passwillaa | /usr/lib/makekey` username

It's working when I don't have the special character in there. How can I deal with this? Thanks in advance for your help.
Acclaimed Contributor
James R. Ferguson
Posts: 21,184
Registered: ‎07-06-2000
Message 2 of 8 (1,285 Views)

Re: Using Makekey and Usermod.sam

Hi Pete:

# /usr/sam/lbin/usermod.sam -F -p "$(echo passwillaa|/usr/lib/makekey)" username

Regards!

...JRF...
Occasional Visitor
Pete H_1
Posts: 4
Registered: ‎06-02-2009
Message 3 of 8 (1,285 Views)

Re: Using Makekey and Usermod.sam



JRF,
When I tried that the passwd entry, for that user, looked like:

heidenp:a
JTxjqEpomkk:112:20:Peter Heiden,,,:/home/heidenp:/usr/bin/sh


I get a new line after the a and the account won't work.
Acclaimed Contributor
James R. Ferguson
Posts: 21,184
Registered: ‎07-06-2000
Message 4 of 8 (1,285 Views)

Re: Using Makekey and Usermod.sam

Hi (again) Pete:

OK, from the manpages for 'makekey' you can note that input is expected to be ten (10) characters long.

Hence:

# echo "passwillaa"|/usr/lib/makekey

...works; as does:

# echo "passwilla "|/usr/lib/makekey

...but "not":

# echo "passwilla"|/usr/lib/makekey

Regards!

...JRF...
Occasional Visitor
Pete H_1
Posts: 4
Registered: ‎06-02-2009
Message 5 of 8 (1,285 Views)

Re: Using Makekey and Usermod.sam


Ok, I just read that. So the makekey utility has restrictions that won't allow me to create what would be a valid password in HP UX? Is there another way for me to create an encrypted password?
Acclaimed Contributor
James R. Ferguson
Posts: 21,184
Registered: ‎07-06-2000
Message 6 of 8 (1,285 Views)

Re: Using Makekey and Usermod.sam

Hi (again) Pete:

Is there another way for me to create an encrypted password?

Yes, see my Perl script in this thread:

http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1252591

Regards!

...JRF...
Occasional Visitor
Pete H_1
Posts: 4
Registered: ‎06-02-2009
Message 7 of 8 (1,285 Views)

Re: Using Makekey and Usermod.sam


James,
Thank you VERY much. That worked great for me. We now have a script that will change both our application server password, as well as an Oracle password. Now I have to come up with a way of having this script run when a password, on the HP UX system, expires. I'm going to search through the forums, but if someone can point me in the right direction it would be much appreciated.
Visitor
MahboobEllath
Posts: 4
Registered: ‎11-30-2012
Message 8 of 8 (806 Views)

Re: Using Makekey and Usermod.sam

Hi,

 

I have tested the same and its working fine in untrusted systems,but unfortunately its not working trusted systems..

 

Could you please explain the reason what could be..

 

-Mahboob

The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.