Double SSH and execute interactive shell

bashshellssh

I need a bash script to ssh into server a then server b then execute an interactive shell.

This is what I have:

ssh -t -t server-a.com exec "ssh -t -t server-b.com <<<EOF
cd /pylons/web/app/
. envs/bin/activate
paster shell /lib/config.ini
EOF

It goes all the way but then "hangs" on the shell. I can type but I get no output.

I also tried the below. It stops after it connects to server-a.com

ssh -t -t server-a.com exec "ssh -t -t server-b.com "
cd /pylons/web/app/
. envs/bin/activate
paster shell /lib/config.ini""

Best Answer

You should have << instead of <<<.

Or perhaps:

ssh -t -t server-a.com ssh -t -t server-b.com '"
cd /pylons/web/app/
. envs/bin/activate
paster shell /lib/config.ini "'