First time i work with computer i amazed much with the idea of take control of one machine in the other side of the world , after some time this become part of my unconscious idea of how Linux administration tasks getting done
Linux remote GUI is not only need by system administrators it’s also need for anyone who needs to use graphical interfaces on multiple machines. I will dedicate this tutorial for how to Remote Desktop Linux with VNC server and client solution
Excellence is to do a common thing in an uncommon way.
Booker T. Washington
What is VNC ?
VNC (Virtual Network Computing) is a cross-platform thin client technology originally developed by Olivetti Research Labs in Cambridge, England, who were later acquired by AT&T.
VNC is a graphical desktop sharing system that uses the RFB protocol to remotely control another computer. It transmits the keyboard and mouse events from one computer to another, relaying the graphical screen updates back in the other direction, over a network.
What is VNC system parts ?
VNC consists of a client, a server, and a communication protocol.
- The VNC server is the program on the machine that shares its screen.
- The VNC client (or viewer) is the program that watches and interacts with the server.
- The VNC protocol (RFB) is very simple, based on one graphic primitive from server to client (“Put a rectangle of pixel data at the specified X,Y position”) and event messages from client to server.
How VNC server start ?
vncserver is used to start a VNC desktop. vncserver is a Perl script which simplifies the process of starting an Xvnc server. It runs Xvnc with appropriate options and starts some X applications to be displayed in the VNC desktop.
vncserver can be run with no options at all. In this case it will choose the first available display number (usually :1), start Xvnc as that display, and run a couple of basic applications to get you started. You can also specify the display number, in which case it will use that number if it is available and exit if not, eg:
#vncserver :10
Editing the file $HOME/.vnc/xstartup allows you to change the applications run at startup (but note that this will not affect an existing desktop).
How-to connect to VNC server with VNC client ?
executing the command
#vncviewer host:display
Where host is the host on which the VNC server is running and display is the number of the X Window System display on which the VNC server is running.
How-to change twm window manager in the VNC server ?
by default VNC server configurations automatically start the twm window manager, However, the VNC server’s use of a startup script makes it easy to start any window manager, desktop environment, and X Window System applications that you’d prefer to use in the VNC environment. But be advice that for low-bandwidth conditions, the twm window manager may still be the best choice.
To chnage twm you will have to edit default xstartup ~/.vnc/xstartup in the last line you will find
twm &
chnage it to
| startx & | In case you need to launch Gnome upon login via VNCserver |
| startkde & | In case you need to launch KDE desktop upon login via VNCserver |
Clean shutdown VNC Server ?
cleaner way to shut down a running VNC server process is to use the vncserver script’s -kill option:
$ vncserver -kill :number
If your system crashes while running a VNC server or the VNC server itself crashes, you should clean out the files associated with the VNC server in the /tmp and /tmp/.X11-unix directories. For example, if your VNC server was running on display number 1, you would delete the files /tmp/.X1-lock and /tmp/. X11-unix/X1. Doing so ensures that any newly started VNC server will start on the first available X display.
Web browser as VNC client (viewer)
One of the most amazing and unique feature when using VNC it’s the capability to use the web browser to connect to the VNC server which make your web browser act like VNC client. This can be very handy method to access your servers. This flexibility come from great mind of vnc designer and they thought of a solution to the roaming user problema hassle-free way to make your VNC servers available even if the system you’re using doesn’t have VNC client software installed. All VNC servers include a small built-in web server that can serve the Java classes needed for any Java-enabled browser ( Firefox – Internet Explorer – Opera – Mozilla and there is much more) to connect to the VNC server.
You must also make sure that the following line is not commented out of the :
| TightVNC | $cmd .= ” -httpd $vncClasses”; |
| RealVNC | $cmd .= ” -httpd $vncJavaFiles” if ($vncJavaFiles); |
The variable $vncClasses and $vncJavaFiles in vncserver script is the location(s) where Java Classes and Associated Files can be found
The VNC server listens for HTTP connections on port 5800 plus the number of the display being exported. Therefore, to view a VNC session running on
display 1 of the host www.msamir.net, you would access the URL http://www.msmair.net:5801/.