Using X11 forwarding

The X11 forwarding feature is a special case of port forwarding. The X11 protocol is used by PC X server software and the connection is made from the remote server to the local PC, a reverse of other client programs such as email or telnet. By using the X11 forwarding, you can skip the setting up complicated port forwarding rules required to run X server software. 

Step 1: Configuring X11 Forwarding in Xshell

  1. On the File menu, click Open. The Sessions dialog box shows up.
  2. Click a session in which you want to configure the tunneling service.
  3. Click the Properties button on the toolbar. The Properties dialog box shows up. Click Tunneling category. 



  4. In the X11 Tunneling section, check Forward X11 connections to.
  5. If you have Xmanager installed in your system, select Xmanager.
  6. If you use another PC X server, select X display location and enter the proper display name.
  7. Click OK to save your changes.


Step 2: Configuring X11 forwarding service in the SSH server

Setup the configuration file in the following table.

SSH serverConfig fileSetup
OpenSSH/etc/ssh/sshd_configX11Forwarding yes
SSH.COM/etc/ssh2/sshd2_configAllowX11Forwarding yes


Now, you are ready to execute remote X11 applications in the SSH shell prompt securely over the SSH tunnel.

Step 3: Running X applications from the Xshell terminal

  1. If Xmanager is installed on your PC, just go to the next step. Otherwise, run the PC X server installed on your PC first.
  2. Establish the SSH connection using the session you configured.
  3. At the shell prompt of Xshell, execute an X11 application as following: 

    [nathaniel@intranet ~]$ xterm &

    You have tried to run X11 applications securely over the secure SSH tunnel so far. If you have any problems in running X11 applications, see the Troubleshooting section below.


Troubleshooting

  1. Xshell shows "Failed to execute Xmanager: Make sure that Xmanager is correctly installed in this system." message. 

    The session is configured to forward the X11 connection to Xmanager, but Xmanager is not found in your system. To use Xmanager, download and install Xmanager and run X11 application again. To use other PC X servers, open the Properties dialog box and go to the X11 Tunneling section. Then, select X display location and enter the proper X display name.

  2. Xshell shows "The remote SSH server rejected an X11 forwarding request." message. 

    Make sure that the X11 forwarding feature of the remote SSH server is enabled.
    • For OpenSSH servers: In the file /etc/ssh/sshd_config, set
      X11Forwarding yes
    • For SSH.COM servers: In the file /etc/ssh2/sshd2_config, set
      AllowX11Forwarding yes
    • For other ssh server products: Refer to the SSH server manual from its provider.