Tuesday, February 27, 2007

A dual screen hack: X2VNC and Win2VNC

These two little gems: X2VNC and Win2VNC from Fredrik Hubinette have become one of my favorite utilities to use at work.

Imagine a dual head system where your left screen has KDE, your right screen has WinXP and your mouse moves freely between the two. Using X2VNC and/or Win2VNC you can do it.

My setting is like that described above: two PC's one with Kubuntu and the other running Windows XP. I have RealVNC server installed on the Windows box and use X2VNC in the Linux box to connect to the Windows one and presto! now I can use a single mouse and keyboard to control both boxes.

It is possible to do the connection the other way around by installing the X11VNC server on the Linux box and then connect to it from the Windows box using Win2VNC. The last time I tried this configuration the mouse in Win2VNC wasn't as smooth as in X2VNC.

You cannot use the RealVNC server in Linux in this case because this VNC server creates a new X11 session for each VNC connection, With x11vnc you get control over the current X11 session.

Windows Setup for dual screen hack:

Download and install the free RealVNC. Start the VNC server in user-mode or as a system service. For testing purposes configure "No Authentication" on the Authentication tab of the server options and make sure the Linux box IP address is configured on the Connections tab of the server configuration.

To open the configuration dialog of the VNC server simply select "Options" in the context menu (right click) of the VNC icon on the system tray.

Linux Setup for dual screen hack:

Install the x2vnc package of your distribution. In Kubuntu edgy/feisty is as simple as:

sudo aptitude install x2vnc

Then run the following command to enable the dual screen hack:

x2vnc -east windows_ip_address:0

Now if you move your mouse to the far right of you screen (Linux Screen) it should appear on your Windows screen and now everything you type on your keyboard would appear also on your Windows screen.

If your Windows screen is to the left of the Linux screen then you must replace the "east" option with "west". You can also use "north" and "south" in case you have the Windows screen above or below the Linux one.

Security Setup
To avoid unauthorized access to your system it is better to enable access control to your VNC server. To do this simply enable password authentication on the RealVNC server and restrict the IP addresses that can connect to the server in the connection settings.

On the Linux side we must create a passwd file so that X2VNC can authenticate with the server. For this we need the vnppasswd command utility that comes with the RealVNC server package:

sudo aptitude install vnc4server

After installation is finished we issue the next command to create a password file:

vncpasswd

This command will prompt you for a password that must be the same you configured on the Windows RealVNC server. Once you enter the password a passwd file will be created inside the .vnc/passwd directory inside your home directory. To make X2VNC use this file for authentication when connecting issue the command:

x2vnc -east -passwdfile ~/.vnc/passwd windows_ip_address:0

I have created a desktop shortcut where I configure this command to avoid having to type it every time I boot the machine. Now with a simple click I enable the dual screen hack.

No comments:

Post a Comment