0

I have 3 machines..

  • A. My local machine at home (MacOSX).
  • B. Machine at work that I can SSH into (middle man). It is a small virtual machine running Ubuntu server and I can open new ports
  • C. Another machine at work running Ubuntu Desktop with vine for remote desktop access I can access this machine with SSH via B.

So I can SSH from A -> B and from B I can see open ports in C. I want to access C using a VNC client.

Is there a way to setup a tunnel from A to C through B?

0

Based on answer https://superuser.com/a/371082/281372, here's what you need to do specifically:

user@machineA $ ssh -fN -L59595:machineC:59595 user@machineB \
                -c 'ssh -fN -L59595:machineB:5900 user@machineC' &

user@machineA $ vncviewer localhost:59595

This opens a ssh session from A to B with a tunnel from A:59595 to B:59595; and in the ssh session on B, it opens a new ssh session from B to C with a tunnel from B:59595 to C:5900.

Then back on A, you vnc to localhost:59595. It is tunneled to B:59595, which then catches it and retunnels it to C:5900.

I have not tested it.

(In a previous answer I recommended socat and netcat, but it's clear now you want the whole tunnel protected by ssh.)

1
  • Thx, I hava tested your vnc and ssh answers, but seems like VNC uses a slightly more complex protocol since I reach the computer, send the password but the connection doe s not progress anymore – jab Apr 21 '20 at 13:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.