Hi
I have a script which uses expect and I run it on solaris 10 to set a common password for all users. I run it as `./script
password` but when I tried to log into the system then I do not really have to type password, pressing ENTER on keyboard logs the user into system. (ssh)
This below is script and I feed it with a file with user names.
Quote:
#!/bin/ksh
ChangePasswd()
{
/usr/local/bin/expect <<EOF
set newpassword [lindex $argv 0]
spawn passwd $user
expect "New Password: " ## not expect "password:"
send "$newpassword\r"
expect "Re-enter new Password: " ## not expect "Re-enter"
send "$newpassword\r"
expect eof
EOF
}
#while read -p "Enter Userid:" user
while read user
do
if [[ $user != '' ]];
then
ChangePasswd $user
fi
done <ab
|
################### ab is file with user names