There's a machine in my company which people connect to through VPN and work from there. That way, the whole network is blocked from their private machines but opened for that specific box. I want to be able to assign specific VNC ports to specific people, is that possible? if so, how is it done?


Yes you can. You can edit your /etc/sysconfig/vncserver file, the one which holds sessions information. There, you may configure specific ports in the following format:

VNCSERVER="0:root 5:itaig"

Then, for each session, configure the relevant screen resolution:

VNCSERVERARGS[0]="-geometry 1152x864"
VNCSERVERARGS[5]="-geometry 1600x900"

Check out an example from one of my servers:

[root@localhost ~]# cat /etc/sysconfig/vncservers
VNCSERVERS="0:root 2:noc2 3:noc3 6:itaig 8:maher"
VNCSERVERARGS[0]="-geometry 1152x864"
VNCSERVERARGS[2]="-geometry 1152x864"
VNCSERVERARGS[3]="-geometry 1152x864"
VNCSERVERARGS[6]="-geometry 1600x900"
VNCSERVERARGS[8]="-geometry 1600x900"

That way, each [number] represents a port, the default port is 5900, so following the numbers you will use, the ports will be configured.

0:root stands for 5900
2:itaig stands for 5902

Then, from any vnc client you'll be able to connect like so:

vncviewer ip:5900


vncviewer ip:2

And it will automatically translate it to ip:5902.

I hope that answers your question.

  • I'll have to try it and get back to you... – user256033 Dec 2 '14 at 16:28
  • No problem, take your time. – Itai Ganot Dec 2 '14 at 16:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy