1

The following script seems to simply ignore the rsa fingerprint/continue connecting prompt. I have tried different things, but I simply cannot figure out why it is not working as expected.

#!/usr/bin/expect
spawn /usr/bin/rsync --rsync-path=/home/tmp -azr --dry-run -e ssh --stats user@host.com:/home/tmp /home/tmp

set timeout 10

set pass "password"

expect {

        "*yes/no*": {
                send "yes\r";
                exp_continue
        }
        "*password*"

}

send "$pass\r";

exit 0

This gets stuck at the following part.

The authenticity of host 'host.com (IP)' can't be established.
RSA key fingerprint is [fingerprint].
Are you sure you want to continue connecting (yes/no)?

Any suggestions as to what I might be doing wrong?

  • 1
    You have a spurious colon (:) after the yes/no string pattern. This is a syntax error which will stop the script at the expect line. – meuh Nov 11 '16 at 17:57
  • Oh man, how could I miss that? I had a previous version of a script that only entered the password and the password string was without ", but had a colon and that worked. That is where my confusion came from. Ty very much! – Michael Weber Nov 11 '16 at 23:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.