Share mouse and keyboard using x2x and ssh

Table of Contents

Share mouse and keyboard using x2x and ssh

I have a desktop computer and a laptop, both on the same table and connected to the internet. When I drag my mouse trough the left side of the screen of the desktop, cursor is shown on my laptop.


Short version

$ ssh -X tero@laptop.example.com "x2x -west -to :0." &


Detailed instructions

First, install x2x on the laptop. If your laptop is running Debian or Ubuntu,

desktop$ ssh tero@laptop.example.com
laptop$ sudo apt-get install x2x
laptop$ exit

Above, “desktop$” is the prompt of the desktop computer. “ssh tero@laptop.example.com” simply connects to laptop trough ssh with username “tero”. You can install x2x with “sudo apt-get install x2x” if you are a member of admin group. If you don’t have “universe” component in your repositories, enable universe before trying to install x2x.

Then start x2x on the slave trough X window system tunnel:

desktop$ ssh -X tero@laptop.example.com "x2x -west -to :0." &

Above “ssh -X tero@laptop.example.com” connects to laptop.example.com. “-X” (capital X) enables X window system tunnel. The command after ssh “x2x -west -to :0.” is run on the remote server. Because x2x is a graphical user interface (X) program, it can capture mouse on the left side desktop’s screen. Daemon sign “&” means that ssh goes to background, and you get back to your dear prompt after pressing enter.

Drag cursor trough left side of screen (west) to the desktop of laptop. Type something on your keyboard, it’s magically transferred to laptop. Drag cursor (that’s on laptop’s screen) trough rigth side of the screen, and control your main computer again.


See also

Lee 2002: About x2x: Sharing input devices between X11 servers in software

Karvinen and others 2006: Ubuntu Bug #38843: Requires input in stdin to work

Gusarov: x2x, project homepage and bug ticket system.

Karvinen and others 2006: x2x ticket 5: Requires input in stdin to work

Karvinen and others 2006: x2x ticket 6: ssh example for manpage



Posted in Old Site | Tagged , , , , , | Comments Off on Share mouse and keyboard using x2x and ssh

Comments are closed.