linux - Expect never matches the pattern -
i trying write script enter password automatically, seems expect never matches pattern.
#!/usr/bin/expect -- set pass "test" set timeout 5 spawn sudo ssh -i ~/.ssh/id_rsa stricthostkeychecking=no vongrad@localhost expect { timeout { send_user "\nfailed password prompt\n"; exit 1 } "*ssword*" { send "$pass\r" } }
do have suggestions?
how using key (without password) logging in instead of password write in script? way avoid being promped passwords ssh. example described here: http://www.thegeekstuff.com/2008/11/3-steps-to-perform-ssh-login-without-password-using-ssh-keygen-ssh-copy-id/
Comments
Post a Comment