how to change the port vnc is running?

Scot L. Harris webid at cfl.rr.com
Fri May 14 22:19:22 UTC 2004


On Fri, 2004-05-14 at 12:58, Gustavo Rahal wrote:
> Hi
> 
> How to change the port vncserver is running? Actually, I don't know if
> the port change is something to do with X or vnc. 
> The situation is that I want to access my PC that is inside a home
> network (there is a server doing NAT with iptables). I already have
> access to the server from outside but I would like to access my computer
> (ip 192.168.....) so I imagine that I would have to do a port forward to
> my PC, is that right? Since the server is already running vncserver I
> have to forward different ports...
> 
> Appreciate any help

If you are already using ssh to access the server from outside then
setup an ssh tunnel.  I did this using putty on the laptop.  Under the
ssh settings setup an entry specifying a local port (such as 5905) that
is mapped to your servers IP address and port 5901.  Then when you
connect via ssh the tunnel is setup for you.  Then run vnc using
localhost:5 for the machine you are trying to connect to.  This will
cause the vnc session to be routed via the local port 5905 to the ssh
tunnel which ends up on the remote server.  vnc assumes the port starts
at 5900 so when you use :5 it actually hits port 5905 on your local
machine.  

Have been using this for some time now.  Nothing to setup on the remote
server except to have vnc listening on the default port.

Check out the vnc web site.   It think that is where I found the
information to set this up.

There were two parts that were a little confusing.  When you setup the
ssh tunnel that establishes a tunnel directly from your machine to the
remote server.  So you need to use the actual IP address on the remote
machine to define its end of the tunnel.  The other part that was a
little confusing was how to get vnc to use a specified port.  Instead of
spelling out the whole thing it adds 5900 to the value you put after the
colon.

Hope that helps and did not muddy the waters more.
 
-- 
Scot L. Harris <webid at cfl.rr.com>





More information about the users mailing list