HenryChang
asked on
Assign Unix password inside script
I want to assign a default password for all of the newly create unix account inside a script so that I don't need to assign for them one-by-one.
Small typo.
expect "Re0enter new Password:"
should be
expect "Re-enter new Password:"
expect "Re0enter new Password:"
should be
expect "Re-enter new Password:"
ASKER
Hi,
Can you send the whole script to me? I have download the relevant softwares.. My script is :
root@hkgss1100043:/root>ca t test
/usr/local/bin/expect
spawn passwd [lindex $argv 0]
expect "New Password:"
send "password\r"
expect "Re-enter new Password:"
send "password\r"
expect eof
Thanks a lot
Can you send the whole script to me? I have download the relevant softwares.. My script is :
root@hkgss1100043:/root>ca
/usr/local/bin/expect
spawn passwd [lindex $argv 0]
expect "New Password:"
send "password\r"
expect "Re-enter new Password:"
send "password\r"
expect eof
Thanks a lot
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi,
HenryChang,
I think you missed #! in front of /usr/local/bin/expect in your script. So change it to:
#!/usr/local/bin/expect
HenryChang,
I think you missed #! in front of /usr/local/bin/expect in your script. So change it to:
#!/usr/local/bin/expect
The script would look like
#/usr/local/bin/expect
spawn passwd [lindex $argv 0]
expect "New Password:"
send "password\r"
expect "Re0enter new Password:"
send "password\r"
expect eof