Operating System - HP-UX
1748248 Members
3733 Online
108760 Solutions
New Discussion

Re: User password change script

 
Vengat_teme
Occasional Contributor

User password change script

Hi Team ,

 

 I need sample script for user password change.

 

my requirement

 

once i excute script -> ask user name -> after enter the username -> password change automaticaly.

 

kindly provide your value input ASAP.

 

Thanks

1 REPLY 1
Matti_Kurkela
Honored Contributor

Re: User password change script

And what should the new password be?If it should be fixed, anyone who can read the script can easily uncover the password.

If it should be randomly generated, what do you want to do with it? Display it? Write it into a file? Or do you really want to create passwords that are not known to anyone at all?

 

The "/usr/sam/lbin/usermod.sam" command can be used to change a password automatically, but it will need the new password in hashed ("encrypted") form. Note: the hashed passwords can contain characters that are special to the shell, so you must use quotes or backslashes to prevent the shell from interpreting them.

 

/usr/lbin/makekey can be used to convert passwords to hashed form (see "man makekey"), but because it requires the password to be exactly 8 characters + 2 characters of salt, it is not the best possible choice.

 

The syntax for usermod.sam is:

/usr/sam/lbin/usermod.sam -F -p '<new hashed password>' <username>
MK