Skip to main content

Remote X Display

Displaying Remote X Applications On Your Local Display

...ie, connect to a remote machine, run the X application there, but displayed on your local CentOS 5 desktop.

The "correct" solution is to use tunneled X displays through ssh:

$ ssh -Y user@remote
remote$ application

But We're Banging Rocks Together Here

If your remote system doesn't have ssh for whatever reason, you have to do a bunch of things to do it old-school:

  • add to /etc/gdm/custom.conf in the [security] section:
    # If true this will basically append -nolisten tcp to every X command line, a
    # good default to have (why is this a "negative" setting? because if it is
    # false, you could still not allow it by setting command line of any particular
    # server).  It's probably better to ship with this on since most users will not
    # need this and it's more of a security risk then anything else.
    # Note: Anytime we find a -query or -indirect on the command line we do not add
    # a "-nolisten tcp", as then the query just wouldn't work, so this setting only
    # affects truly local sessions.
    DisallowTCP=false
  • add to /etc/sysconfig/iptables BEFORE the line about ESTABLISHED,RELATED
    -A RH-Firewall-1-INPUT -p tcp -m tcp --dport 6000 -j ACCEPT
  • recycle iptables:
    $ sudo service iptables restart
  • restart X (ie logout, log back in)
  • in your local terminal, get the xauth cookie. You want the one which is for your local system, and is NOT the /unix socket:
    $ xauth list
    centos5-dave/unix:0  MIT-MAGIC-COOKIE-1  3ff263c171f0dea508c3ebf4b80365cb
    centos5-dave:0  MIT-MAGIC-COOKIE-1  f1e47ba23d87b8ec8db65cda67e99684
  • on the remote system (bash/ksh presumed), you have to export your DISPLAY setting, then add the xauth cookie for that display:
    remote$ export DISPLAY=172.30.0.154:0.0
    remote$ xauth add 172.30.0.154:0  MIT-MAGIC-COOKIE-1  f1e47ba23d87b8ec8db65cda67e99684

You should now be able to open xlogo as a simple connectivity test.