In Linux, the resolution size of default VNC is restricted. The default VNC enabled by remote desktop applet is less customisable, it prevents some large window from properly displaying. This post outline how to change the VNC session resolution.
1. Enable vncserver manually, to generate a default configuration file.
Please skip this step if you have done it before. The “vncserver” command starts the VNC server session for the clients to connect to it. Example output is shown below.
# vncserver New 'geeklab:2 (root)' desktop is geeklab:2 Starting applications specified in /root/.vnc/xstartup Log file is /root/.vnc/geeklab:2.log
geeklab is the hostname, and
:2 is the VNC Display Number.
2. Kill the vncserver
Use the command “vncserver -kill” to kill the VNC server session we just started in the step 1. The syntax to kill the VNC server session is.
# vncserver -kill [VNC Display Number]
In out case, we will use the VNC display number as “:1“. For example,
# vncserver -kill :2 Killing Xvnc process ID 1696
3. Edit ~/.vnc/xstartup
Un-comment the following 2 lines if they are already hashed out. In most cases these will be already uncommented out.
# vim ~/.vnc/xstartup unset SESSION_MANAGER exec /etc/X11/xinit/xinitrc
4. Start the VNC server again with a screen resolution
You can now start the vncserver session again, with new screen resolution that can be defined on the command line. For example:
# vncserver -geometry 1280x1024
5. Connect to the VNC server
Connect to the VNC server session from the VNC viewer of your choice. The syntax to connect to a VNC server session from VNC viewer client is as shown below.
# vncviewer [VNC Server IP/Hostname]:[VNC Display Number]
For example, to connect to the VNC servers session geeklab with IP address 192.168.10.12 with VNC session display number :2, use the below command.
# vncviewer 192.168.10.12:2
How to configure VNC Server on CentOS/RHEL 6