Synergy [vnc], ssh, cron and X from XP to Ubuntu
This is sort of a complex one.
I run a laptop at work which has a secondary monitor and gets its IP via DHCP. I also have a linux box under my desk which is static IP. This, too, has a monitor.
I got sick of switching keyboards all the time, and tried to find a software solution to my problem, before I invested in a KVM.
Synergy is a neat little tool which creates a 1-pixel wide vnc window on the edge of your screen, so when you mouse to the edge, you get control over the other computer.
I have tried setting up the linux box as a the server, and the laptop as the client. This results in me not being able to access both laptop screens, only the master. This is not ideal. So, setting the laptop as the master, and the linux box as the client works a treat.
However, since the laptop is DHCP, when I boot up, I get a new IP most days. So, I still have to log into the linux box, and restart synergyc
Now, I thought I might be able to get around this using ssh.
I could ssh into the linux box, kill synergyc, restart with my new ip. However, I get the following error messages:
chewy@toaster:~$ synergyc -f -1 <ip_address>
INFO: synergyc.cpp,708: Synergy client 1.2.7 on Linux 126.96.36.199-gg5vb7 #1 SMP Tue Nov 29 11:33:51 PST 2005 i686
DEBUG: CXWindowsScreen.cpp,776: XOpenDisplay(":0.0")
Xlib: connection to ":0.0" refused by server
Xlib: Invalid MIT-MAGIC-COOKIE-1 key
WARNING: synergyc.cpp,337: cannot open secondary screen: unable to open screen
So, if I muck about with xhost (xhost +, for example) it works. However, I can't run xhost + from the remote command line, because I get 'cannot open display ""'. So, I still need to do something manually from the linux box. Not wanting to leave xhost + active, I do xhost - afterwards.
I've since discovered xauth, but again, can't get this working.
What I -really- want to do is have a cronjob, which picks up the ip address of my laptop automatically (done this bit) and restarts synergyc when it detects a new ip (done this bit, too).
The problem is the same as that with ssh = I get the cookie denied stuff, and nothing I can do with xauth seems to make it work.
So, basically, how can I set up a cronjob with permission to set up a process that requires usage of x?