#!/usr/bin/expect -f set timeout 30 set hostname "59.110.19.30" set username "root" set password "@CuiYuJian040618" spawn ssh $username@$hostname expect { "*password:" { send "$password\r" } "*Are you sure you want to continue connecting*" { send "yes\r" expect "*password:" send "$password\r" } } interact