cancel
Showing results for 
Search instead for 
Did you mean: 

change passwd using script

Pradep
Regular Advisor

change passwd using script

Hi All,

I need to autogenerate complex passwords and change it for users, using a single shell script. not expect script.

can some pls share any script with me ?

thanks.
4 REPLIES
Doug O'Leary
Honored Contributor

Re: change passwd using script

Hey;

What you're asking is not a generic, simple script, particularly if you're putting conditions on it such as no expect.

You can use perl with the Expect module to automate the password exchange or you could use /usr/sam/lbin/usermod.sam -p ${encrypted_passwd}.

I've written several scripts that use the perl Expect module; honestly never tried the usermod.sam but it should work.

The attached perl script will generate random passwords. You can keep at it until you find one you like...

$ ./gen_pwd
Password: 4dah9vuh
$ ./gen_pwd
Password: qud4tam5

Doug

------
Senior UNIX Admin
O'Leary Computers Inc
linkedin: http://www.linkedin.com/dkoleary
Resume: http://www.olearycomputers.com/resume.html
Pradep
Regular Advisor

Re: change passwd using script

Hi Doug,

perl will do, as its installed in all the servers, but Expect is not installed.

does expect module comes with Perl. if yes, perl script is ok for me. can u give me full script to generate and change passwd together ?

thanks.
Suraj K Sankari
Honored Contributor

Re: change passwd using script

Hi,

If possible make you system trusted then when you or any user want to change the passwd he/she will get the choice to create auto generated passwd by system itself.
No need to right any script to change passwd.

Suraj