Using X11 forwarding to run programs remotely via NSH


X11 (also known as X Windows) is a graphical windowing system used over network connections rather than on an attached display device. You can use X11 forwarding to run programs remotely through BMC BladeLogic Network Shell (NSH) or the nexec utility. 

The nexec utility automatically configures the RSCD agent to capture X11 traffic by resetting the DISPLAY variable and tunneling traffic through the RSCD Agent to the server that initiated the nexec call. This allows you to securely tunnel X11 traffic using the same security features as other NSH utilities.

This page discusses the following aspects of X11 forwarding:

Prerequisites for end-to-end X11 forwarding

For X11 forwarding to work end-to-end using the RSCD Agent and NSH or the nexec utility, ensure that the following prerequisites are met:

  • The client machine must have either NSH or nexec installed.
  • The target machine must have an RSCD Agent running, along with X11 runnable applications (such as xterm, xclock, or xeyes).
  • The machine on which you want to export the user interface of an X application must have an X display server (such as Hummingbird Exceed®) installed.
  • X11 forwarding must be enabled for the RSCD Agent on the target machine.

    By default, X11 forwarding is turned on. You can use the x11_fwd option in the rscd entry in the RSCD Agent's secure file to turn off X11 forwarding or to turn it back on. For more information, see Configuring-the-secure-file.

    Note

    If you change the value of the x11_fwd option in the secure file while the RSCD Agent is running, restart the agent for your changes to take effect.

Examples of nexec commands for X11 forwarding

The following examples illustrate common scenarios in the use of X11 forwarding:

Example 1

Environment:

  • The server machine on which the RSCD Agent runs is named susrh3vxn.
  • The client machine is named engwinXP. This machine has NSH or an RCP client or Application Server installed on it. In addition, an X display server is running on 0.0.

To export the UI of an X application running on susrh3vxn to engwinXP, you can use the following commands:

  • To display the xclock application window on the engwinXP console:

    engwinXP% cd //susrh3vxn
    susrh3vxn% DISPLAY=engwinXP:0.0 nexec -e xclock
  • To display the xeyes application window on the engwinXP console:

    engwinXP% DISPLAY=engwinXP:0.0 nexec susrh3vxn bash -c xeyes

    or

    engwinXP% export DISPLAY=engwinXP:0.0
    engwinXP% nexec susrh3vxn bash -c xeyes
Example 2

Environment:

  • The server machine on which the RSCD Agent runs is named susrh3vxn.
  • The client machine is named RH1729c. This machine has NSH or an RCP client or Application Server installed on it.
  • The machine that runs the X display server on 0.0 is named Win-X-Server.

To export the UI of an X application running on susrh3vxn to Win-X-Server and display the xeyes application window on the Win-X-Server console, you can use the following command:

RH1729c% DISPLAY=Win-X-Server:0.0 nexec susrh3vxn bash -c xeyes

Closing an exported X application window

To close the exported X application window, use the close button of the window or send a control-C to the nexec application running on the client machine. This will ensure that the X11 tunnel created through RSCD is closed.

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*