Saturday, October 06, 2007

Pretty GUI apps over SSH

I've been running some of my X applications i.e. scite, kdevelop, etc over SSH on my work pc for a long time now. Recently a friend of mine asked me how it was done so I decided to post it here for those looking for a similar solution.

First, make sure your SSH server has this option enabled "X11Forwarding yes" in your /etc/ssh/sshd_config file and then restart the SSH server.

On your client machine, establish a connection using "ssh -2 -4 -C -X user@server". This effectively tells your SSH client to connect to the SSH server using protocol version 2 running on IPv4 with compression enabled and to allow X forwarding.

Alternatively, you can create a .ssh/config file on the client and add the following options to it which gives the same result as above
Protocol 2
Compression yes
AddressFamily inet
ForwardX11 yes



And you're done. You can now run remote X programs on Linux or Windows (using cygwin).

NOTE: 1 possible error that you might encounter is "Gtk-WARNING **:cannot open display:". If this happens, execute your ssh command with the following "ssh -2 -4 -C -X -v user@server" and look at the debug output. If you see something similar to "debug1: Remote: No xauth program; cannot forward with spoofing." make sure you have xauth installed. If you do, delete your existing .Xauthority file, logout and login again. This will cause a new .Xauthority file to be created and hopefully it will solve the annoying error message above. Enjoy ;)

No comments: