
I found it myself
Quote:
#!/bin/ksh
ChangePasswd()
{
/usr/local/bin/expect <<EOF
spawn passwd $user
expect "New Password: "
send -- "$2\r"
expect "Re-enter new Password: "
send -- "$2\r"
expect eof
EOF
}
#while read -p "Enter Userid:" user
while read user
do
if [[ $user != '' ]];
then
ChangePasswd $user $1
fi
done <ab
|
## ab file has the list of users whose password I am changing
I run the above script as
./script <
password I want>
that sets the password for all users to what I want !
