X11 over Secure Shell

When I first started using Slackware Linux, I struggled to find answers to why my “ssh -X node” wouldn’t work. I was sent on a wild goose chase for about a year. Finally, I found the solution to my problem.

First, modify the server side secure shell configuration found in /etc/ssh/sshd_config. There are a couple of options you will need to modify in order to allow X11 over SSH.

In the following example, my client and server are two different nodes. So if you want to enable X11 over SSH on both sides, make sure you make client-side and server-side changes for each node.

#X11Forwarding no
#X11DisplayOffset 10

You’ll want to change that default setting to the following, ensuring that you remove the # comment as well:

X11Forwarding yes
X11DisplayOffset 10 

Next, you’ll want to configure your client side settings in /etc/ssh/ssh_config.

#ForwardX11 no

And change this to, again, don’t forget to remove the comment:

ForwardX11Trusted yes

Finally, restart the server side ssh daemon using the following command:

# /etc/rc.d/rc.sshd restart

*Note:

I would recommend making a script that will automate these changes, because sometimes the slackpkg manager will install a new configuration file for either of the client/server side services. Pay attention to those messages when using slackpkg to ensure you don’t over-write configuration files you’ve already manipulated!

Leave a comment