I have an access to a remote Ubuntu machine of my Lab's, and the machine has public IP aaa:bbb:cc:ddd. (I am going to build a website.) In the Lab, I can connect successfully with SSH, in CLI, to aaa:bbb:cc:ddd. I want to set up remote desktop from the remote machine. I have followed the instructions here.

However, VNC listens to port 5901, and the administrator only opens ports 22 and 80 of aaa:bbb:cc:ddd. Isn't port 22 already used by SSH? How do I connect to the machine with VPN through port 22? Should I ask the administrator to open port 5901? Or, if VNC is not possible, what are alternatives which provide a remote desktop session?

  • what is your local computer ? a windows ? a linux ?
    – Archemar
    Jan 27, 2020 at 13:44
  • Linux (My laptop, connecting in the Lab Wifi network) Jan 28, 2020 at 9:10

2 Answers 2


You can setup vnc as described.

Then you use tunnelling (as you can access you lab host).

set tunnel

If ubuntu (or any other desktop linux)

ssh -L 5901:localhost:5901 labhost

This will forward local connection to 5901 (5901: part) to lab connection 5901 (localhost:5901 part).

If putty, go to (edit configuration) connection ==> ssh => Tunnels

source port : 5901
Destination : localhost:5901
(X) Local ( ) Remote ( ) Dynamic

then add (tunnel). use putty to connect

local vnc

Using your local vnc client, use localhost:5901 as url for connection.

  • Publick key authentication is also possible in this case, though putty is a bit peculiar in this... but puttygen is the program to be used. Jan 27, 2020 at 15:25
  • I was focused on vnc and tunnelling part. putty or ssh connection can be automated of course or by password, this hardly change overall solution.
    – Archemar
    Jan 27, 2020 at 15:27

What you could do (a bit complicated) is deploy your own VPN solution.

Use a virtual machine in the lab as a VPN client and run the VPN server on your own machine. That way you aren't affected by the lab's policy on incoming traffic.

What tools do you want to use for your work ? As i wrote in the comment you could setup public key authentication for your user (so ssh doesn't require a password) and configure the tools such that it uses ssh to access files on the ubuntu server.

This https://blog.devolutions.net/2017/4/how-to-configure-an-ssh-tunnel-on-putty describes how to with putty start a ssh tunnel to your server.

  • aaa:bbb:cc:ddd is going to be the website server, so I think if I can get any kind of remote desktop access to it, then I know the rest. (My networking concept is limited) Jan 27, 2020 at 12:57
  • 1
    What is your usage of the rdp session ? Can you run the editor tools on your home machine while the tool uses a ssh connection to access files. This is how i personally uses emacs in this case. You could in fact rather easily set up public key authentication (that is if the ssh server on the machine allow publickeyauthentication.) Can you run a prototype web server on the home machine and then simply copy over the files ? You don't need to run a UI at all on the web server. Jan 27, 2020 at 13:10
  • Okay I will try editor method next time, or perhaps ask the administrator open port 5901 (we are on Lunar New Year vacation now). Jan 28, 2020 at 9:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .