Linux expect and spawn id exp6 not open issue


I was having an issue with my expect script

spawn ssh licensecheck@192.168.1.0
Password:
Authentication failed.
send: spawn id exp6 not open
    while executing
.....
.....

This my code…..

#!/usr/bin/expect
set timeout 20
spawn ssh -o PubkeyAuthentication=no licensecheck@192.168.1.0

expect "Password: " {send "mypassword\r"}
expect "$ " {send "/usr/xxx/xxx/xxx/lmstat -a\r"}
expect "$ " {send "exit\r"}

Do check out whether the expression is correct. In case, I leave a space after “Password: ” After I remove, the space, the error is gone. There is also a write-up in a form. Do take a look at Linux – spawn_id: spawn id exp6 not open

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.