Sometimes you are not allowed to use keys to autologin to your machines, so you must find a way to automate your
login using password authentication.
This expect script can help you do it:
#!/usr/local/bin/expect —
set timeout 30
spawn ssh user@ipaddress
while 1 {
expect {
“*(yes/no)?” { send “yesn”}
“*password:” { send “passwordn”}
“*user]#” { send “shutdown -h nownexitn”}
}
}
266/433