3

Ok, I cannot seem to get VNC connection to work. I'm not sure if I understand it. So:

I want to connect from my home pc (let's call it athome) to my work desktop (let's call it atwork, but I have to tunnel through a connection server (let's call it workserver).

So can someone explain me how I can use, e.g., Vinagre to connect from athome to atwork via workserver (and share the desktop, which I enabled at atwork vino-preferences)? I can get access them all fine via ssh in the terminal, but I can't get Vinagre to connect.

I've tried with the "Use host ... as SSH tunnel" option. It didn't work.

I've tried ssh -v -N -R 5902:atwork:5902 user@workserver in the terminal and then connect to localhost:5902, but it didn't work.

I'm probably doing something wrong, so I would be very happy if someone could explain me clearly how it should be done.

Thanks

Lu Kas
  • 197
  • I understand how to ssh into a server and then get its remote desktop via VNC, but I'm not sure my answer will work when atwork and workserver are different machines. How are they connected? – Organic Marble Nov 27 '17 at 23:24
  • Euhm, not sure. It's a local network at work I guess. I ssh from athome to workserver and then do again an ssh into atwork. But they are indeed different machines. – Lu Kas Nov 27 '17 at 23:39
  • This is probably why your method listed above didn't work; sort of a double tunnel is needed. I will see if I can simulate such a thing on my LAN, interesting question! – Organic Marble Nov 27 '17 at 23:42
  • Hmm, ok, I guess I was really misunderstanding. I thought this was standard practice. Thanks for the help. – Lu Kas Nov 27 '17 at 23:49

1 Answers1

4

I was able to simulate (I hope) your situation, if I understood it.

The need is to connect to a machine atwork's VNC server. atwork is not accessible via ssh from the client machine athome. However, atwork is accessible via ssh from the intermediate machine workserver. workserver is accessible via ssh from athome.

If this is the correct scenario, I was able to connect in a similar situation. I used remmina which by default tries to connect on port 5900. Here is how I did it using intermediate port 5901. Adjust ports as necessary in your situation.

enter image description here

  • Set up first tunnel from athome to workserver.

    ssh -L 5900:localhost:5901 -N -f -l username workserver
    
  • Set up 2nd tunnel from workserver to atwork

    SSH into workserver and enter the next command. Leave this ssh window open.

    ssh -L 5901:localhost:5900 -N -f -l username atwork
    
  • Back on athome, start remmina and connect to localhost

Somewhat to my surprise, it worked.

When done, go back into the workserver ssh window and killall ssh. Then killall ssh on athome.

pa4080
  • 29,831
Organic Marble
  • 23,641
  • 15
  • 70
  • 122
  • (sorry for my late reply, really had to go to sleep)----------------------------------------------------------------------------------- Yes, that is indeed my situation. This seems to work, although I had to change the port to 5901 in the ssh line for workserver (vncserver seems to start at port 5900 + desktop). Thanks. Now just one (small) problem, the killall ssh doesn't seem to work on workserver. Probably has to do with that it's a Sun Microsystem. – Lu Kas Nov 28 '17 at 09:35
  • Also, I had to solve the grey screen issue, which I did following the instructions here. However, I don't seem to get any kind of taskbar on the remote desktop, nor do I manage to open a terminal. Any ideas why or how to solve? – Lu Kas Nov 28 '17 at 09:39
  • I haven't run into those issues, I'm especially not sure why the killall didn't work. The idea of that is to stop the tunnel but maybe it got stopped some other way? As for the other issues, they may be vinagre related, which I've never used. I'm a novice at this stuff myself and looking into questions like this helps me learn. Which also means that my answer may not be the optimal solution. – Organic Marble Nov 28 '17 at 14:03
  • No, I also used Remmina, like you said. It might be vnc4server related, since I used it to reproduce the "grey screen" solution. The killall might not work due to it being a different operating system. workserver is setup by the IT department at work for ssh login purposes, but it runs SUN OS. I've noticed ps aux also doesn't work, for example. I understand it was to stop the tunnel, but it was certainly not stopped in another way. I had to stop them individually with kill (yes them, had to try a few times to make it work :P) – Lu Kas Nov 28 '17 at 14:59
  • I've had some issues with remmina but mostly involving scaling of the screen, plus it seems to hang up sometimes, especially when the client is an old pc. re: the taskbar, were you viewing the entire screen? No idea on the terminal. – Organic Marble Nov 28 '17 at 15:07
  • Yes, I was using fullscreen. But I'll play a bit around with different programs or settings this evening after work if I find some time. – Lu Kas Nov 28 '17 at 16:13