Running VNC port# <30

pcm81

Senior member
Mar 11, 2011
598
16
81
Good evening.
I am in a bit of a predicament and am hoping someone can help me out.

I have a raspberry pi at home and I am trying to VNC into it (I am 1500 miles away). The problem is that I did not realize that VNC uses ports 5900+ to listen for viewer connections; so I only opened ports 1-30 on my router at home and directed them to raspberryPi. I can SSH into pi, run command prompt as root, but I have no idea how to force VNC server to listen on one of the open ports. I looked into IPTables, Local SSH and misc servers that I can explicitly specify listening port for; all to no avail. I am a total Linux noob and would greatly appreciate a step by step quick guide to setup VNC server on Pi, with incoming traffic going through port #<30.

If IPtables tunnel is the best way to do it, please tell me which version of IPTables I need to install. I have v1.4.14 installed, but not sure how to set it up. Saw a guide referring to a -nat argument to iptables; however my version does not have it...

Thanks ahead
 

Red Squirrel

No Lifer
May 24, 2003
70,166
13,573
126
www.anyf.ca
Never open up VNC directly. What you do is use a SSH tunnel. Basically in your SSH client you setup the tunnel, it will make a local port point to a remote port. So make localhost:5900 point to localhiost:5900 on the server. When you connect to 5900 locally with that ssh session opened it will connect to the vnc on the server.