VNC - Virtual Network Computing

There are many ways to do VNC, starting with different platforms from which to view the different hosts, progressing through all the various VNC applications, and ending with all the authentication mechanisms. If you want to do VNC, pack a lunch and sit down with Google and a note pad. Maybe pack your dinner too because you may be in for a long time searching. Far too many sites just regurgitate the man pages, or expouse the standard steps with little actual useful information. What follows here is what I've successfully done. Ymmv.

Background

VNC uses the port range 59nn where nn is the display number of the X-11 session being viewed (or 58nn through a web browser). In a trusted LAN environment VNC is simple; run the server on the remote host, and run the viewer on the local host. Over the internet it's best to use a secure tunnel such as ssh. When using a tunnel, the remote host connects via 127.0.0.1 so there is no need for it to listen to the LAN interface. Therefore, if possible start the VNC server with a -localhost option to restrict listening to just 127.0.0.1

Because MS-Windows doesn't do virtual displays, only the existing Windows desktop can be viewed with VNC. If viewing a NT-4 box, the vnc menu has an option to send Ctrl-Alt-Del to the NT box to get a login screen. I don't know about the more recent versions of Windows. I only use MS-Windows to administer remote Linux boxes, not the other way 'round.

Most Linux VNC server programs start a virtual X-11 session on the remote host. If you want to view a real X-11 session, use x11vnc.

sudo aptitude install x11vnc


NOTE: My experience with this indicates you should initially try this out while in view of both hosts. If the existing session is in screen-blanking mode with a black screen, you may think you haven't connected when you really have. In a Gnome desktop, when the remote mouse moves the login dialogue doesn't make it to the remote display and all you see is a black screen.

Once the local host is displaying the remote X-11 session, F-8 should pop up a menu offering options such as "Full Screen", "End Session", etc.

If tunneling, your router must port-forward TCP port 22 (or whatever SSH port your systems use). If you haven't used SSH before, stop here and get that all working before you proceed with VNC.

The difference between the xtightvncviewer and the normal vncviewer is the data encoding, optimized for low bandwidth connections. The difference between tightvncpasswd and vnc4passwd is that with tightvncpasswd the server passwords can be encrypted instead of merely "obfuscated"

Packages

tightvncserver - Provides:

vnc4server - Provides:

xtightvncviewer - Provides:

xvnc4viewer - Provides:

gtkvncviewer - Provides:

x11vnc - Provides:

The Debian Alternatives System

If you have more than one package installed it will be up to you to set the symbolic links. Oddly, vnc4server doesn't provide the vncconnect binary and the tightvncserver doesn't provide the vncconfig binary. Presumably, they are interchangeable.

I have all the above packages installed. In /usr/bin I have the following actual files:

And the following symbolic links:

Note: I have changed the link for vncpasswd from vnc4passwd to tightvncpasswd because that's what I use.

In /usr/share/man/man1 I have the following actual man pages:

And the following symbolic links:

Note the symbolic link Xvnc. This is an obvious error and should be renamed to Xvnc.1.gz
I also changed the link for vncpasswd.1.gz from vnc4passwd to tightvncpasswd.1x.gz

And now the fun stuff

Because a large percentage of VNC use is for people forced to use MS-Windows that want to connect to their Linux box, I'll discuss that first. There are two excellent programs that can be installed on a USB flash drive: portaPuTTY and TightVNC. TightVNC viewer for Windows is available as an executable that does not require installation. Also TightVNC Portable Edition is a specially packaged distribution which makes TightVNC keep its configuration and connection history in the installation directory (typically, on a USB flash drive), instead of using the registry of the host computer.

portaPuTTY is a hacked version of PuTTY that stores all its information in files, not in the registry.

  1. On you home Linux box, sudo aptitude install tightvncserver
  2. Port forward the SSH port on your router/firewall to the Linux box.
  3. Go to work
  4. On the Windows box install PuTTY (or insert your flash drive), set up a normal SSH session.
  5. Verify that you can SSH to your home Linux box. Close the session.
  6. Reload the PuTTY session, go to Connection/SSH/Tunnels dialog box.
  7. Enter 5901 for Source port, localhost:5901 for Destination
  8. Enter the run command: tightvncserver -geometry 800x600 -depth 8 -localhost -nevershared -dontdisconnect :1
  9. Don't forget to save the session
  10. Open the session. It should be a SSH session to the Linux box. Minimize it.
  11. Run tightVNC viewer. Enter localhost:1 and the password you set for tightvnc server.
  12. You now have a secure SSH tunnel running VNC between work and home.

If you want to access your real X-session, substitute x11vnc for tightvncserver. Run

x11vnc -find

if you are logged into an X-11 session. The display will be :0 instead of :1 so you will use 5900 for your SSH parameters.

To shrink the frame buffer from 1280x1024 to 980x768 run

x11vnc -scale 3/4 -find

If NO ONE is logged into an X session yet, but there is a greeter login program like "gdm", "kdm", "xdm", or "dtlogin" running, you will need to find and use the raw display manager MIT-MAGIC-COOKIE file. Some examples for various display managers:

Sometimes the command "ps wwwaux | grep auth" can reveal the file location. also, x11vnc will have to be run with sudo

sudo x11vnc -display :0 -auth /var/lib/xdm/authdir/authfiles/A:0-XQvajk

more todo

and more


Send mail to the Webmaster

logo This site best viewed with a browser
Warning: This is a Debian centric site
Many thanks to Debra and Ian Murdock for making Debian possible
First created Feb 17, 2010 ~ Last revised July 11, 2010

Valid XHTML 1.0 Strict Valid CSS!