Showing posts with label VNC. Show all posts

Fixing the VNC's blank/grey screen with three checkboxes problem (~/.vnc/xstartup in Ubuntu)

After installing VNC server on Ubuntu (usually occurs on servers), sometimes one may face a problem in which after logging in by a VNC client/viewer, it shows just a blank screen with three checkboxes. (See the image at the end of post)

To fix this issue, first of all, Check if you have any Desktop Environment (eg, Unity, Gnome, KDE, xfce, lxde etc) installed on your system. You may use: echo $DESKTOP_SESSION or you can verify from env.

In my case, I have installed LXDE on Ubuntu server. It is important now to find the exact executable path of lxde, which is /usr/bin/startlxde in my case.

Replace the content of your ~/.vnc/xstartup and paste following lines:
#!/bin/sh
xrdb $HOME/.Xresources
xsetroot -solid grey
export XKL_XMODMAP_DISABLE=1
/usr/bin/startlxde
Note: Above code is only valid for lxde.

Should work fine now! :)




Accessing a VNC server over SSH

Prerequisite: Server should be accessible by SSH

Configure and start VNC server on your server machine. For example, vnc4server could be installed on Ubuntu and similar flavors. (In this post, I am not covering the steps to configure a VNC server)

On the client or on your local machine, we need to create an SSH connection that securely forwards to the localhost connection for VNC. To do this on Linux/OS X, use following command: 

$ ssh -L 5901:127.0.0.1:5901 -N -f -l user server_ip 

If the server is in any local network eg, under some router etc, then setup port forwarding in your router settings for SSH connection (Port 22).
Finally, on the client, install any VNC client (eg, VNC Viewer by RealVNC - available for all platforms), and login to the server as: localhost:5901

When it prompts for password, enter the one you configured for your VNC server.