drawkcaB | Backward Compatible logo

rants and tips about software

X11 forwarding on Slackware

Many times I wanted X11 forwarding to be as simple as

ssh -x host; run program.

Until today, that never worked for me. But today I was in the mood to try to make it work somehow.

It turns out, it can be made to work that way, and it’s super easy. The thing is that X11 forwarding via SSH is disabled by default (which is very reasonable setting, BTW). To enable it, just open /etc/ssh/sshd_config on the remote host (where you want to run the applications) and make sure it contains the following lines (uncommented):

AllowTcpForwarding yes
X11Forwarding yes
X11DisplayOffset 10
X11UseLocalhost yes

Once you save the file, restart sshd to pick up the new config:

/etc/rc.d/rc.sshd restart

And you’re done. On your local host, just run ssh with -X or -Y parameter. The difference is this:

-X      Enables X11 forwarding.
-Y Enables trusted X11 forwarding. Trusted X11 forwardings are not subjected
   to the X11 SECURITY extension controls.

Gosh, think about all the times I’ve done things in much more frustrating way (via VNC for example).

Milan Babuškov, 2009-06-18
Copyright © Milan Babu┼íkov 2006-2024