Question: When I try to launch any GUI application on a remote server, I’m getting the “cannot open display:” error, as shown below. How do I fix this?
For example, while launching the gedit on remote server, I got the following message.
(gedit:3658): Gtk-WARNING **: cannot open display:
I get similar message when I try to open any GUI application. For example, launching Oracle Installer on remote server also gives the “cannot open display” error.
Answer: You can fix the “cannot open display” error by following the xhost procedure mentioned in this article.
1. Allow clients to connect from any host using xhost+
Execute the following command to disable the access control, by which you can allow clients to connect from any host.
$ xhost + access control disabled, clients can connect from any host
2. Enable X11 forwarding
While doing ssh use the option -X to enable X11 forwarding.
$ ssh username@hostname -X
Enable trusted X11 forwarding, by using the -Y option,
$ ssh username@hostname -Y
3. Open GUI applications in that host
After opening ssh connection to the remote host as explained above, you can open any GUI application which will open it without any issue.
If you still get the “cannot open display” error, set the DISPLAY variable as shown below.
$ export DISPLAY='IP:0.0'
Note: IP is the local workstation’s IP where you want the GUI application to be displayed.
Comments on this entry are closed.
is
# xhost –
will block from using X server from remote login to this system?
for ex:
system1 # xhost –
system2 # ssh -X system1
system1 # gedit new.txt
it opening a new file, it not blocking X server.
love this site, love these articles but xhost? pfft!
hari, when you’re X11 forwarding, you aren’t using xhost for X authentication. the client is using xauth authentication mechanism. the server and client share a secret “cookie”(xauth list to see yours)…. google xauth howto comes up with a lot of references
Unless the network environment is entirely controlled, xhost is a very bad idea [1]. Prefer xauth [2] or other mechanisms. See the Remote X Apps mini-HOWTO for details [3]. (My understanding.)
1: http://www-it.desy.de/systems/services/x11/xsec.html
2: http://www.acm.uiuc.edu/workshops/cool_unix/xauth.html
3: http://tldp.org/HOWTO/Remote-X-Apps.html
xhost is a security nightmare. Just use “ssh -X name@serveripaddress”, then type the name of the progam you want to use.
Really good information. It worked for me.
but If I want to open GUI application on my host which is installed on other host.
Suppose no browsers are installed on my host and if i want to open browser which is installed on other host, how can i do this.
In this case, which host’s IP will be considered for opening sites?mine or accessed?
i hope you understand, what i want to know.
Thanks
rly good solution ..its worked for me
i install geany and when run it got below error. even i update gtk2 and all depended lib. also export DISPLAY=’IP:0.0′ with local ip, can any one help me to remove this error to run geany
#geany
Geany: cannot open display
xhost+ solved it for me, using vnc into a Wheezy headless server.
Thank you for the fix, this has been annoying me for a while now!
i am trying to connect the IBM P740 system via xmanager , for oracle installation .
But i am not able to connect i get “XDMCP connection failed. Try again?”
I have done xhost+ & also set the DISPLAY env variable.
$ echo $DISPLAY
10.217.108.64:0.0
Help me how to enable the remote administration for AIX machine.
Also encountered this error and finally came up with a fix that works for Solaris 10.
The listener was not set to listen. After setting it to true, it works just fine.
svccfg –s /application/x11/x11-server listprop options/tcp_listen
svccfg –s /application/x11/x11-server setprop options/tcp_listen = true
Thank you! 😀
Please my display open
Slappy – best solution, thanks!