No protocol specified couldn't connect to display ":0.0"
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
No protocol specified couldn't connect to display ":0.0"
Hi!
I'm trying to run a script as root, which should make a window pop up, and I think it uses another terminal as the log. At present I only have one terminal open.
It worked a while ago, and now it doesn't. From similar threads I see that other people also said that it fluctuated, but that's all help that I got.
Code:
[root@gnlserv01 scripts]# ./oscar_wizard
No protocol specified
couldn't connect to display ":0.0" at /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/Tk/MainWindow.pm line 55.
MainWindow->new() at ./oscar_wizard line 155
I've tried
Code:
[root@gnlserv01 ~]# xhost root
No protocol specified
xhost: unable to open display ":0.0"
[root@gnlserv01 ~]# xhost +
No protocol specified
xhost: unable to open display ":0.0"
xhost has to be run by the user who owns the X session, not root, because you're giving permission for root to access the display. Also, I don't think xhost can accept "root" as an entry. Try "xhost +localhost".
The program also has to know which display to use. If "echo $DISPLAY" in the root terminal doesn't show the correct display number, you'll have to set the environment variable: DISPLAY=":0.0" (or else set it individually for each command, usually with a "--display=0" option or something similar.
Last edited by David the H.; 09-03-2009 at 10:17 AM.
Reason: Small error correction
I tried doing what you suggested, but it doesn't seem to work, or else I'm not using the write syntax.
Code:
[compchem@gnlserv01 ~]$ xhost +localhost
localhost being added to access control list
[CODE][[root@gnlserv01 ~]# echo $DISPLAY
:0.0
[root@gnlserv01 ~]# /opt/oscar/scripts/oscar_wizard
No protocol specified
couldn't connect to display ":0.0" at /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/Tk/MainWindow.pm line 55.
MainWindow->new() at /opt/oscar/scripts/oscar_wizard line 155
/CODE]
xhost has to be run by the user who owns the X session, not root, because you're giving permission for root to access the display. Also, I don't think xhost can accept "root" as an entry. Try "xhost +localhost".
The program also has to know which display to use. If "echo $DISPLAY" in the root terminal doesn't show the correct display number, you'll have to set the environment variable: DISPLAY=":0.0" (or else set it individually for each command, usually with a "--display=0" option or something similar.
After searching around for the solution to this, I found the simple fact stated here by you requiring me to run "xhost +localhost" as the normal user. Once I did that, I had no more trouble. I now have it set in my script to first "su $NORMAL_USER" before running any other commands, which are performed as root.
It was really annoying that I previously couldn't run any programs requiring root. Now I can launch my Slackware package manager (GSlapt) from the mc console.
Is there a way to set either "init 4" or the user login to X to automatically perform the "xhost +localhost" at the beginning of every session? It would be nice if I don't have to do this every time I log into the X window. Where in /etc/X11 would this have to be done to make the change permanent?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.