Linux Know-How provides a collection of introductory texts on often needed Linux skills.


Remote Desktop using VNC

(VNC = Virtual Network Computing). A very useful application--don't miss it.

VNC is a cross-platform utility that allows me to display a remote graphical desktop over a standard network connection. For example, I can use VNC on an MS Windows PC to display an X-window environment of my mighty Linux server downstairs, or the other way around. VNC will even run over a 56k modem networking, but probably only for fun or in emergency (too slow a connection for normal work).

Recent Mandrake or RH will have vnc on their distributions CD. The MS Windows version you have to download yourself. See http://www.uk.research.att.com/vnc/ for download information and more details.

On Linux, VNC consists of four commands: vncserver, vncviewer, vncpasswd, and vncconnect. I typically need just two of them: vncserver and vncviewer. A brief description of the commands follows.

vncserver

The server that has to be running on the host (remote) computer. You start the server as the user whose desktop will be displayed (don't run the server as root or somebody else somebody may kidnap your computer!).

vncviewer

The local application which connects to the vncserver and displays the remote environment. You need to know the password and ip address of the server to connect.

vncpasswd

Password selection utility for vncserver. The server won't run without password (good behaviour). Therefore, if you don't select one, it will prompt you. Hence, I don't need to explicitly run vncpasswd.

vncconnect

Tells vncserver to connect to a listening VNC viewer on the given computer and port. This way I can avoid giving anybody a password.

Xvnc

A "master" program that I don't really need to run directly (vncserver and vncviewer are scripts which call Xvnc).

For a list of all available options I run:

Xvnc -help

It is not recommenced to run the VNC server as root due to potential security issues. If you need root privileges, login as a user and then execute su

Two examples of "typical" sessions follow.

Example 1. Sitting at an MS Window computer, I can display an X environment from my Linux server, using the following sequence:

[start a DOS terminal and type in the following command]

telnet my_linux_server_name

[log in to your user account on Linux and type in it the following command]

vncserver

[provide a really good password of your choice when prompted; mine was "357+Simon&Garfunkel"]

[re-enter the same password for confirmation]

[watch the messages and note the screen number on which the server is started; mine was ":4"]

[From the "Start" menu on the MS Windows computer, select "Programs" - "Vnc" - "Run VncViewer"

[in the input box that appears, type the server ip address and screen number as shown on the next line]

my_linux_server_ip_address:4

[in the input box that appears type the password as follows]

357+Simon&Garfunkel

[an X-windows desktop should now appear on top of your MS Windows desktop]

[do your work as you normally would in Xwindows]

[when done, switch to the telnet session window and type in it the following two commands]

vncserver - kill :4

logout

Example 2. Sitting at my Linux X desktop, I can display and remotely control an MS Windows computer screen. Hopefully, nobody else is using this MS Windows computer at the same time, because I move its mouse pointer.

[Walk to the MS Windows computer because you probably cannot telnet it]

[From the "Start" menu, select "Programs" - "Vnc" - "Run WinVnc (app mode)"

[From the "System Tray", click the mouse right button on the "Vnc" icon, and select "Properties"]

[In the dialog box that appears, fill in the password. Leave the screen number on "auto".]

[Walk back to your Linux desktop]

[Start an X terminal and type in it]

vncviewer ms_windows_server_name_or_ip

[When prompted, type in the password]

[a MS Windows desktop should now appear on top of your X]

[do your work as you normally would on MS Windows]

[When done, right click on the Vnc icon in the system tray and select "Close VNC".]


Last Update: 2010-12-16