Home
> Tech stuff > SSH using expect scripts
SSH using expect scripts
#!/usr/bin/expect -f set timeout 30 spawn ssh -l USERNAME -o PubkeyAuthentication=no HOSTNAME expect { "password" { send "PASSWORD\r"; }} expect { "bash" { send "sudo su - SU_USER\r"; } "denied" { exit; }} expect { "password" { send "PASSWORD\r"; }} interact;
Categories: Tech stuff
.ssh, expect, PubkeyAuthentication, spawn, sudo
Comments (0)
Trackbacks (0)
Leave a comment
Trackback