Linux – changing the default vncserver port

11 Feb

To change the default port for vncserver on Linux from 5900 (+display number), you must first open the file /usr/bin/vncserver as root (or sudo) with your favorite text editor. If you scroll down to around 25% mark in the file, you’ll see the line:

$vncPort = 5900 + $displayNumber;

Change 5900 to whatever port you would like, save the file, stop and restart the vnc service.

Java (port 5800 + display number) doesn’t seem to change, so how do we change it? This is a little easier. When starting up your vnc server, just add the option “-httpport “. For example:

vncserver -display 800x600 -depth 16 -httpport 5000

Leave a Reply

You must be logged in to post a comment.

ITStudent.org

Linux, security, technology, school, work, and the future of tech.