Archive

Using X2vnc

Using x2vnc

What is x2vnc?

x2vnc is a dual-screen hack. It “will let you use two screens on two different computers as if they were connected to the same computer. The computer with the ‘main’ keyboard must be running X-window, and the second computer should have a VNC server running which will update the contents on the actual screen.

Why?

The scenario: I sit at my desk, with my workstation that runs X. I have my laptop beside me (to the right) which also runs X. I keep having to lean over and use the mouse and keyboard on my laptop which is a pain (I’m a student! I’m lazy!).

It’d be nice if I could “link” the keyboard and mouse of my workstation to my laptop so I could control everything from the one machine. x2vnc lets me do this.

How?

  • Install x2vnc on the workstation (Debian users: aptitude install x2vnc).
  • Install a VNC server on the laptop that exports the current display. x11vnc is ideal for this (Debian users: aptitude install x11vnc).
  • On the laptop, run: x11vnc -storepasswd <password> ~/.vncpasswd

  • Copy ~/.vncpasswd to the workstation.
  • On the laptop, run: x11vnc -rfbauth ~/.vncpasswd -forever -bg -allow workstation_name

  • On the workstation, run: x2vnc -passwdfile ~/.vncpasswd laptop_name:0

(Note: In the above, workstation_name is the DNS name of the workstation. It could also be the IP address. The same applies for laptop_name)

Now if you move your mouse to the far right of your screen and keep going, your mouse should appear on the laptop. The workstation’s keyboard will also “type” on to the laptop. It’s just as though your keyboard and mouse are connected to the same two machines.

Notes

  • If it doesn’t work, is it a firewall issue?
  • My laptop sits to the right of my workstation’s monitor. If your second machine sits to the left, you can add the -west option to x2vnc which means you move your mouse to the far left of your screen and keep going (the default is to the right, or -east).

  • It’s VNC, so you can even link to a Windows or Mac machine if you have one sitting next to you.
  • I can run rdesktop full screen on my laptop and connect to a Windows Terminal Services server and still be able to control everything. Very handy!

Page written by DavidRamsden

Leave a Reply