I want to run a program on a machine that I have ssh access to from a gateway machine that I can access with ssh too.
When I want to run an mpi program on the target machine T, I access to the gateway G from my local machine the usual way :
ssh user@Gateway
Once on the G machine, I start my program on the target machine like this :
ssh Target 'eval $(ssh-agent -s);ssh-add my_key;mpirun --hostfile .hosts program'
This way everything works correctly (notice that I need ssh-agent and ssh-add to run before mpirun, refer to this question for details.)
I want to pass the second ssh command directly to the ssh command on my local machine when I access the Gateway, something like this
ssh user@Gateway "ssh Target 'eval $(ssh-agent -s);ssh-add my_key;mpirun --hostfile .hosts program'"
But this doesn't work, because of the " I think.
PS: I cannot use ssh-agent-forwarding.