Archive for août 2011

Forwarding X11 through ssh

sshThis is an information that you might easily find everywhere, this article is mainly a reminder for myself (and eventually for you 🙂 ).

No need for fancy protocols, in order to run graphical programs on a remote machine we might use ssh, and X11. This has prooved to work well since the eighties 🙂

NOTE : In my exemple, the client is my Ubuntu 11.04 laptop, and the server runs Debian Squeeze, so my explanation covers the ‘debian way’ of doing things.

On the client side :

X11 shall be accessible though tcp.

If you run X directly, which is not my case, Edit the /etc/X11/xinit/xserverrc file, and remove the « -nolisten tcp » option. This modification is optional if you, like me, use gdm.

gdm starts X sessions, so you you have to modify its configuration in /etc/gdm/custom.conf :





restarting gdm :
close you’re gnome session, and then crtl+alt+f1 opens a terminal in console mode.
type the following :

service gdm restart

and then ctrl+alt+f7 brings you back to the gdm prompt.

SSH config :
Then edit the /etc/ssh/ssh_conf :

X11Forwarding yes
X11DisplayOffset 10

On the server side,

edit /etc/ssh/sshd_conf :

Host *
ForwardX11 yes
ForwardX11Trusted yes

and restart the server (fortunately you won’t be kicked out if you do that through ssh), by doing :

$> /etc/init.d/ssh restart

Connections can now handle X11 forwarding

$> ssh -X user@server
$> echo $DISPLAY
$>xeyes &

Catégories :Uncategorized