#!/usr/bin/expect -f set timeout 30 set password "DMUEjmnh6mDs/qlzhpjDzQ" spawn ssh -o StrictHostKeyChecking=no service@2.58.65.188 expect { "password:" { send "$password\r" exp_continue } "$ " { interact } eof { exit } }