Display remote applications on my local X server in Linux
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:
- Linux : Upload the files and directory tree to remote ftp server
- Linux: The hole trick to bypass firewall restriction
- Howto use multiple SSH keys for password less login
- Tunneling VNC connections over SSH - Howto
- Linux Iptables block remote X Window server connection
Discussion on This Article:
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!


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.
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.
Try to disallow TCP connections from within the GDM config and then ssh -X, it should work without having X listen for TCP connections.
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.
drewp,
Thanks for posting ubuntu hints
really a great help yaar.. thanks a lot..
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 ?