I am doing a double hop SSH to get first into a server which has a public IP address and open SSH port, then SSHing into the next computer, while linking my local VNC port to the remote systems port. IN a diagram:
[My Local System] ---SSH Tunnel (port 5900 forward)--> [Server] -- SSH Tunnel (port 5900 forward)--> [Remote system]
I have created a single string command to do all of this, but there is a catch. x11VNC appears to crash an inordinate amount. Like literally I might get 10 mins of work done before my system freezes again and I have to restart x11vnc. But this is not what this question is about.
The command I am using is as follows:
ssh -L 5900:[REMOTE SYSTEM IP]:5900 [email protected] 'ssh [REMOTE SYSTEM IP] 'pkill x11vnc; x11vnc --ncache 10''
Now I have included the PKILL command in here so it will clear out the frozen x11vnc instance that is still running so I can free up port 5900 (and not have zombie processes permeating my system): However this doesnt work. No matter what I do, if its a double hop, this just returns x11vnc, command not found
NOTE: If I remove pkill, this command string works perfectly. But I need to kill the zombie
If from the server however I try running the command:
ssh [REMOTE SYSTEM IP] 'pkill x11vnc; x11vnc --ncache 10'
this works fine! Does anyone know why this wont work when doing a "double hop" ssh connection?