ITG Unix Support
     |  List directory  |  History  |  Similar  |  Print version  

Software > OpenSSH > Configuring OpenSSH for X11 Forwarding

Configuring OpenSSH for X11 Forwarding

OpenSSH supports something called X11 Forwarding, which makes configuration of remote X11 applications much easier. To be brief, when you SSH into any host that allows it, it automatically configures your X11 session, and sends the graphics back to your Windows workstation encrypted with SSH. That's right, you no longer have to mess with setting DISPLAY in your startup scripts or using xauth.

Connecting to another host with X11 forwarding

The easiest way to connect to another host with X11 forwarding enabled is to use the -X argument. For example, you can type:

ssh -X bryce-n1

If you want to set it up so that the -X option is enabled by default, you can edit //etc/ssh/ssh_config or copy that file to ~/.ssh/config and edit it there. Make sure the following lines are uncommented, by removing the # in front of the appropriate lines:

Host *
   ForwardX11 yes

I would recommend commenting out ForwardX11Trusted yes unless you understand it's implications.

Testing the remote display

When you connect to a UNIX machine, you can type the following to see if your DISPLAY has been autoconfigured properly.

> echo $DISPLAY

If it says anything other than localhost, it's quite possible you are not configured properly. If it says nothing, go down to the Configuring the SSH Server line.

To perform an actual test of the graphics, run xclock. A small clock should appear on your desktop if it works.

Changing your UNIX Login Scripts

With SSH Tunneling, you no longer need to set your DISPLAY variable. It should be automatically configured. If you have hardcoded your hostname in your startup file (.cshrc, .profile, .zprofile), be sure to comment it out.

Configuring the SSH Server

SSH servers by default do not have X Tunneling enabled. If your DISPLAY variable is not automatically set, you may have to have the system administrator do this for you.

Edit the /etc/ssh/sshd_config file, and uncomment the following line:

X11Forwarding Yes

After making this change, you will need to restart the SSH server. To do this on most UNIX's, run:

/etc/init.d/sshd restart


Rights rw-rw-r--   tstrombe   ITG

Prev. Configuring automatic ssh login between all users of two hosts