System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

Using Makekey and Usermod.sam

Pete H_1
Occasional Visitor

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.
7 REPLIES
James R. Ferguson
Acclaimed Contributor

Re: Using Makekey and Usermod.sam

Hi Pete:

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

Regards!

...JRF...
Pete H_1
Occasional Visitor

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.
James R. Ferguson
Acclaimed Contributor

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...
Pete H_1
Occasional Visitor

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?
James R. Ferguson
Acclaimed Contributor

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...
Pete H_1
Occasional Visitor

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.
Highlighted
MahboobEllath
Occasional Advisor

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