X11 forwarding over SSH

Sunday, May 28, 2006 by Nate Murray.  

Setting up X11 port forwarding via SSH is a pretty simple task. Here is how to do it between a Slackware and Mac OSX machine. The process should be general enough to expand other *NIX machines. The first step is to setup your sshd to forward X11.

*On the server machine (Linux in this case) add the following line to

X11Forwarding yes

*Also in /etc/ssh/ssh_config add these lines:

ForwardAgent yes
ForwardX11 yes

*Then as root restart sshd:

root@slackware# /etc/rd.d/rc.sshd restart

Running an Application from the Mac

  • Then startup /Applications/Utilities/X11.app on the Mac.
  • Open up an xterm and type the following commands:
user@slackware: ssh -X user@slackware
user@slackware: echo $DISPLAY
user@slackware: xclock
  • The -X tells ssh to forward X11.
  • If you do not get a reponse when you echo $DISPLAY you do not have the X11 forwarding setup correctly.
See also SSH: X11 Forwarding

Who we are:
The Pasadena Ruby Brigade is a group of programmers who are interested in Ruby. We enjoy sharing our ideas and code with anyone who is interested in this wonderful programming language.

Who can join:
Anyone! Just head over to our mailing list and drop us an email.

What we do:
We recently started a project over at RubyForge. This project is a group of programs written and maintained by our members that we thought could be beneficial to the whole community.



Recent Posts