#!/usr/bin/expect -f
spawn ssh-keygen -t rsa
expect "*(/root/.ssh/id_rsa):"
send "\r"
expect "*(empty for no passphrase):"
send "\r"
expect "*passphrase again:"
send "\r"
expect eof
spawn ssh-copy-id root@172.16.53.22
expect "*connecting (yes/no)?"
send "yes\r"
expect "*password:"
send "yjy9H,jChdm\r"
expect eof