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.
Linux provides several powerful administrative tools and utilities which will help you to manage your systems effectively. If you don’t know what these tools are and how to use them, you could be spending lot of time trying to perform even the basic administrative tasks. The focus of this course is to help you understand system administration tools, which will help you to become an effective Linux system administrator.Get the Linux Sysadmin Course Now!
If you enjoyed this article, you might also like..
|
|
|
|






My name is Ramesh Natarajan. I will be posting instruction guides, how-to, troubleshooting tips and tricks on Linux, database, hardware, security and web. My focus is to write articles that will either teach you or help you resolve a problem. Read more about
{ 6 comments… read them below or add one }
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