nixCraft Poll

Topics

Display remote applications on my local X server in Linux

Posted by Vivek Gite [Last updated: December 19, 2006]

By default Linux disallows TCP connections from remote hosts. It prevents applications from running on a remote host and being able to be displayed on the local x server.

To enable the X server to display remote applications open /usr/share/gdm/defaults.conf file. Set DisallowTCP=true to false

# vi /usr/share/gdm/defaults.conf
Set DisallowTCP=true to false
DisallowTCP=false

Setting DisallowTCP to false will allow remote clients to connect.

If you don't know exact location of GDM defaults.conf conf file use find command
find / -name "defaults.conf"

Now restart GNOME aka GDM.
# reboot
OR
# init 3
# init 5

How do I test new setup?

Type any one of the following command on the client
xhost remote-ip
xhost remotehost
xhost remote.server.com

Now SSH into the remote client and type any one of the command:
xeyes -display remote-ip:0
xeyes -display remotehost:0
xeyes -display remoteserver.com:0

xeyes should popup on client system. Enjoy!

Want to stay up to date with the latest Linux tips, news and announcements? Subscribe to our free e-mail newsletter or RSS feed to get all updates. You can Email this page to a friend.

You may also be interested in other helpful articles:

Discussion on This Article:

  1. Thrift Says:

    You may already be aware of this, but a much simpler and more secure way is to just ssh in with the -X (-Y on some Linux distros) flag which will set up an ssh tunnel to allow the same functionally to occur as well as automagically set the DISPLAY variable correctly, so that you don’t have to add -display as a flag to the applications you launch or edit the GDM settings.

    This method doesn’t require you to allow the xserver to listen on your ethernet interfaces and doesn’t rely on IP based security.

    The only time where I would really think that the way you have mentioned would be a better solution is if you don’t have SSH available, such as for compatibility with VMS or something like that. At which point you’d just use telnet instead of SSH and do everything else just as you have mentioned. You could manually set the DISPLAY variable as opposed to using -display as a flag though, which can be convenient.

  2. nixcraft Says:

    Thrift,

    In this specific case GDM was disabled for disallows TCP connections from remote hosts. So I had to edit the file and reload the config. BTW it was RHEL 5.0 beta that developer testing for software compatibility.

    Appreciate your post.

  3. Thrift Says:

    Try to disallow TCP connections from within the GDM config and then ssh -X, it should work without having X listen for TCP connections.

  4. drewp Says:

    Just to elaborate on the last comment (for newbies and search engines):

    Check if your X server isn’t even listening like this:
    % ps ax | grep X
    6081 tty7 SLs+ 204:24 /usr/bin/X :0 -br -audit 0 -auth /var/lib/gdm/:0.Xauth -nolisten tcp vt7

    To get the -nolisten out of there, edit the file /etc/gdm/gdm.conf which (on ubuntu) ships with line 230 like this:
    DisallowTCP=false

    Set that to ‘true’ and restart X.

  5. nixcraft Says:

    drewp,

    Thanks for posting ubuntu hints :)

  6. rajeesh Says:

    really a great help yaar.. thanks a lot..

  7. B!n@ry Says:

    nixCraft,

    y don’t we just stick with the -X option that is passed to ssh while connecting to a host ?

    What is the different between both ?

Leave a Reply

We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word

Copyright © 2004-2008 nixCraft. All rights reserved - TOS/Disclaimer - Privacy policy - Sitemap - Powered by Open source software.