Click to See Complete Forum and Search --> : a really big desktop


Joeri Sebrechts
10-07-2001, 09:20 AM
I have two desktop machines, one which doubles as a network gateway, which is always on (jane), and one which is my primary desktop workstation (ender). Their screens are side to side, and they share a keyboard/mouse pair through a belkin KVM switch.

The irritating thing about this setup is that I need to press the select button on the switch each time I want to work on the other screen. I wanted a way to switch over easy, so this is what I did:

The first thing I tried was just using x2x. This is a well known program which will open a 1-pixel wide transparent window on one side of your desktop, and capture mouse movements when you move in it and send those mouse movements to another X server. This way you can move your mouse of one side of your desktop, and land on the desktop of the other screen, keyboard actions also get redirected, and the selection buffer is also shared between the desktops. Very handy, and it looks like a xinerama setup, even though there are two PC's behind it instead of one.
This is a nice way of working, but it requires manual setup. So, I ran it from a script on jane that contained this:
while true;
do
x2x -east -wait -to ender:0;
done

This script was backgrounded from my .xinitrc, which made sure that whenever the other machine (ender) was running and allowed access to jane, the desktop would be shared. Nice, but it had two problems. First, I had to allow access to jane, so it could run the x2x connection to ender. Secondly, the signals, including any passwords I typed were unencrypted. Even though this is just on my home network, I'm paranoid, so it had to go.

That's when I replaced the setup with an ssh connection. I created a public/private key pair with ssh-keygen on jane. Or actually, the ssh setup of debian did this for me if I remember correctly. And then I copied .ssh/identity.pub from jane to .ssh/authorized_keys on ender. This allows ssh logins from jane to ender, without asking for a password.

Then I replaced my original script with:
while true;
do
ssh -X -c blowfish ender 'x2x -west -from localhost:0 -to ender:10';
sleep 20s;
done

This time the x2x was running on ender instead of jane, but since it runs the connection over the ssh connection (which listens on ender:10) it's encrypted. I selected blowfish as algorithm because the man page of ssh said it's much faster, and with mouse movements every little bit of speed you can gain counts. When large files are transferred across the network you can see the mouse getting slower to respond, but it's useful this way. The sleep is just meant so hte continual attempts of ssh to open a connection doesn't tax the system and network resources too much when ender isn't running. Maybe there is a better way to do this, but this way works.

Then to allow x2x to actually run on the x server on ender I made sure that the X server allowed local accesses. Since I use the kdm session manager I added this after the kdmdesktop line in /etc/X11/kdm/Xsetup:
xhost +localhost
This is not perfectly secure, since anyone on ender could access my desktop now. But I'm the only user of ender, so anyone who's on ender would by definition have already hacked his or her way inside of my machine. The major problem was that I couldn't get the security mechanism of X to work. X security sucks balls. I'm sure it can be made to work. I just couldn't do it. (If anyone can explain how to do X security the decent way, please do)

Anyway, this makes sure that as soon as the kdm chooser displays itself the desktop between the two computers becomes shared, with the shared link being encrypted, and it remains shared until I log out, in which case jane will nicely wait until ender runs an X session again.

kuber
10-07-2001, 04:22 PM
That's some pretty bad-*** work there.

Super Bakemono
10-08-2001, 01:35 AM
truely bad ***, go madison...

siflis
10-09-2001, 08:22 PM
hardcore, all the way...very impressive!