I need to connect to multiple servers from a local machine with a root password. I need to connect to a server over ssh, perform a command, exit and connect to the next server. Usual thing, I would say. Of course, there are some good examples in the internet. The most suitable is the one listed below:
socket=$(expect -c "
spawn ssh -o StrictHostKeyChecking=no $user@$host $cmd
send -- \"$passw\r\"
send -- \"\r\"
This script connects fine at home to my server set up in VirtualBox. But I cannot connect at work. I am attaching a file with all output I see. I would be grateful for any help. Of course I am replacing password and hostname. I assure you I set the correctly them with no typos.