Quantcast
Channel: Active questions tagged expect - Unix & Linux Stack Exchange
Viewing all articles
Browse latest Browse all 158

expect script sending password before prompt

$
0
0

I have written a small expect script for automatic ssh to remote server. But sometimes my expect script don't work. Actually it sends password before password prompt. Here is my script

#!/usr/bin/expect -fset password xyzzys# now connect using sshset host [lindex $argv 0]spawn ssh vivek.gagrani@$hostexpect "*?assword:*"send -- "$password\r"send -- "\r"interact

When running this script I see below output sometimes:

spawn ssh vivek.gagrani@bvdev429xyzzys         ----> password sent before askingvivek.gagrani@bvdev429's password:

How to fix this ?


Viewing all articles
Browse latest Browse all 158

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>