Running an X application through SSH tunneling rather than X11 forwarding

When running a remote X11 application, you can use the SSH protocol to run the X11 application to bypass any network restrictions or needing to make additional configurations.

However, even if you connect to the SSH server, if X11 forwarding is not turned on or if X11 forwarding cannot be used for other reasons, the X application will not run immediately.

Even in these types of cases, you can run X11 applications using regular SSH tunneling.

Using regular SSH tunneling in an Xstart session

  1. Run Xstart, click ‘New’, and then click ‘Setup’ for the SSH protocol.

  2. In the ‘SSH Protocol Setup’ dialog box, click the ‘Tunneling’ tab and then click the ‘Add’ button to set the following settings.

     

    Type(Direction): Remote (Incoming)
    Source Host: localhost
    Listening Port: 6020 (We’ve set it as 6020 here, but you can enter any random port number above 6010.) If another process is occupying port 6020, set it to a different value. The listening port minus 6000 becomes the DISPLAY number. In our case, the DISPLAY number would be 20.
    Destination Host: localhost
    Destination Port: 6030 (Enter a port number between 6000 and 6255.) This port number minus 6000 becomes the DISPLAY number of Xmanager. In our case, the DISPLAY number would be 30.

  3. Click ‘OK’ to save the forwarding rule and close the ‘SSH Protocol Setup’ dialog box.

  4. In the Xstart dialog box, click ‘Advanced’ to open the ‘Advanced Options’ dialog box.

  5. In the ‘Advanced Options’ dialog box, turn off ‘Allocate display number automatically’ and then enter 30 in ‘Display Number’, which is related to the value set in ‘Destination port’ of the Forwarding Rule we configured in an earlier step. This number becomes Xmanager’s DISPLAY number.

     

  6. Enter the path and name of the remote X application you want to run in the Xstart command. Let's run xterm. At this time, set the DISPLAY environment variable before the command. Enter DISPLAY number 20 (=20.0) corresponding to the port number determined in ‘Listening Port’ of the Forwarding rule we configured in an earlier step.

     

     

  7. Click the ‘Save’ button to save it, then click ‘Run’ to run the Xstart session.
    You can see that xterm connects to remote server number 20 (TCP port 6020) and runs successfully.


    In the Windows system notification area, you can see that Xmanager is waiting on 30 (=30.0) (TCP port 6030).

     

     

     

Using regular SSH tunneling in an Xshell session

  1. In Xmanager (Xmanager Classic in Xmanager 7), click File → ‘New’ → ‘XDMCP session’ and then select None (Passive) as the Method.

     

  2. In the ‘X Server’ tab of ‘Properties of New Session’, turn off ‘Allocate display number automatically’ and then set a random value between 0 and 255 in the ‘Display Number’ field.

     

     

  3. .Click OK successively to create and run the session.

     

    In the Windows system notification area, you can see that Xmanager is waiting at number 30 (=30.0) (TCP port 6030) specified in 2 above.

  4. Create an Xshell session.

  5. In the Tunneling section, click ‘Add’ to add a tunneling rule as shown below.

     

    Type(Direction): Remote (Incoming)
    Source Host: localhost
    Listening Port: 6020 (We’ve set it as 6020 here, but you can enter any random port number above 6010.) If another process is occupying port 6020, set it to a different value. The listening port minus 6000 becomes the DISPLAY number. In our case, the DISPLAY number would be 20.
    Destination Host: localhost
    Destination Port: Enter 6030, which is the Xmanager DISPLAY number determined in step 2 above plus 6000.

  6. When you press ‘Connect’, the session will be saved and then run.

  7. In the terminal, set the DISPLAY environment variable to 20 (=20.0), which is the value related to the ‘Listening Port’ determined in step 5, as shown below, and then run the X application.


    You can see that xterm connects to remote server number 20 (TCP port 6020) and runs successfully.