Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating passwords with scripts and no inputs 1

Status
Not open for further replies.

krishania

Instructor
Mar 7, 2001
22
US
I want to create a script that would run on Solaris 8, that would read the username and password arguments into the script and actually create the password for that user. The password comand does not allow me to do the following:

Code:
USERID=$1
PASSWORD=$2
echo $PASSWORD | passwd $USERID
Please help.
 
Check out expect (should be available from sunfreeware.com).. This is great for dealing with dialogue from programs .. I think it might even come with a password change script.
 
#change multiple passwors in passwd


#!/bin/sh
cut -d: -f1 /etc/passwd | while read $user
do
usr/bin/passwd $user
done


All u have to do is run this script and give input from a file which
contains 300 * 2 passwords ...cos passwd command asks for a password
confirm ....U should be logged on as root for this .
somescript.sh<yournewpasswordfile

yournewpasswordfile should be like ....
password1
password1
password2
password2 barazani
bara_zani@yahoo.com
&quot;Unix is user friendly. It's just selective about who its friends are.&quot;
 
I haven't tried ChrisBroadway's solution yet. I am in the process of downloading tcl which expect needs.

However, I tried barazani's solution, but it did not work. It still prompts for the password.

I will let you know if it can be done with expect.

THanks a lot.
 
I downloaded expect and you are right. It has a program that creates passwords on the fly. Works like a charm.

Thanks a lot :)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top