Wednesday, July 11, 2007

changing the default port of vnc server in Fedora

Another quicky:
To change the default port of vnc server running under Fedora Core, edit /usr/bin/vncserver. Replace all instances of 5900 with <your desired port number - 1>. That is a "minus 1" there, as vncserver will start to listen on the default port number specified in /usr/bin/vncserver + 1.

In my case, I noticed that my companies' proxy still had port 3389 open. So, in /usr/bin/vncserver, I changed the default port of 5900 to 3388. Just to confirm: 3389-1=3388. Yes.

You must then restart vncserver:
[root@computer ~]# service vncserver start
Starting VNC server: 1:root
New 'computer:1 (root)' desktop is computer:1

Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/computer:1.log

[ OK ]
[root@computer ~]# netstat -na | grep 'LISTEN '
tcp 0 0 127.0.0.1:8000 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:2208 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:5801 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:6001 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:920 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:3389 0.0.0.0:* LISTEN


Et voila!

VNC is up and running on port 3389 and I can slide through the company firewall to get to my home box! Sweet! Of course, VNC traffic is not encrypted, so a wiser solution would be to use an SSH tunnel home. But when I need to open a brief session to access content on my home box, this solution is adequate.

G'night!

No comments:

Feel free to drop me a line or ask me a question.