I need to concatenete a
cd command with an
ssh jump host:
:~$ ssh -tt -C -X user1@server ssh -tt -C -X user2@host "cd ~/my/work/directory ; bash"
but I get the following error:
bash: line 0: cd: /home/user1/my/work/directory: No such file or directory Connection to host closed.
Seems that ssh try to move to
/my/work/directory in the server machine. So I tried to substitue
~/ with the full path
/home/user2 but, I get the same error:
Connection to host closed.
In both cases ssh bring me from the client home directory to the server home directory. I also tried to jump host in two different steps (client -> server server -> host) and it works. It seems that the
cd step was done in the first ssh (client -> server) instead of the second one (server -> host).
Do you have any suggestion?