LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-11-2005, 10:28 AM   #1
tethysgods
Member
 
Registered: May 2004
Posts: 166

Rep: Reputation: 17
cannot open display as root


I am having this problem as root.

For instance, I want to install netscape in /usr/local, so I have to do this
as root. If I wanted to install it in my own directory, the windows pop up and
everthing is fine.

In the csh I do a

setenv DISPLAY :0.0

and it shows up when i do "env".

But I still get

Xlib: connection to ":0.0" refused by server
Xlib: No protocol specified

GtkWarning** cannot open display: :0.0
 
Old 08-11-2005, 10:31 AM   #2
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 270Reputation: 270Reputation: 270
Run:

xhosts +

Which allow all users to run applications as themselves in an X environment logged in as another user.

You can specify users as well, man xhosts for more details.
 
Old 08-11-2005, 10:40 AM   #3
tethysgods
Member
 
Registered: May 2004
Posts: 166

Original Poster
Rep: Reputation: 17
I had tried xhosts plus even though I am on
a stan alone machine, but when I do that
it tells me it cannot open display :0.0!
 
Old 08-11-2005, 10:40 AM   #4
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 270Reputation: 270Reputation: 270
export DISPLAY instead of setenv DISPLAY
 
Old 08-11-2005, 10:47 AM   #5
tethysgods
Member
 
Registered: May 2004
Posts: 166

Original Poster
Rep: Reputation: 17
First off. when I su to root and do an env
I do get DISPLAY :0.0 in the first place,
you do export in bash, and setenv in csh.
 
Old 08-11-2005, 10:49 AM   #6
tethysgods
Member
 
Registered: May 2004
Posts: 166

Original Poster
Rep: Reputation: 17
I should add, I cant get any man pages for
xhost, I assume that is because it's a network
thing, and my machine is stand-alone.
 
Old 08-11-2005, 11:06 AM   #7
tethysgods
Member
 
Registered: May 2004
Posts: 166

Original Poster
Rep: Reputation: 17
Solved it!

I had to do xhost +localhost as user before
changing to root
 
Old 08-11-2005, 11:10 AM   #8
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 270Reputation: 270Reputation: 270
Quote:
Originally posted by tethysgods
Solved it!

I had to do xhost +localhost as user before
changing to root
Well yeah, the user running X has to give the permissions, not the user trying to run the application in X..
 
Old 08-11-2005, 11:50 AM   #9
blackman890
Member
 
Registered: Oct 2004
Location: Iceland
Posts: 94

Rep: Reputation: 15
but it's root...
 
Old 04-13-2010, 01:33 PM   #10
lamachine
LQ Newbie
 
Registered: Apr 2010
Posts: 8

Rep: Reputation: 0
Quote:
Originally Posted by tethysgods View Post
Solved it!

I had to do xhost +localhost as user before
changing to root

I’ve run xhost +localhost as user it didn’t fix anything.
When I try to run xclock as user or root I end up with “Error: Can't open display: 0.0”
I'm running virtual server Debian/Lenny.
 
Old 04-13-2010, 02:12 PM   #11
lamachine
LQ Newbie
 
Registered: Apr 2010
Posts: 8

Rep: Reputation: 0
Quote:
Originally Posted by lamachine View Post
I’ve run xhost +localhost as user it didn’t fix anything.
When I try to run xclock as user or root I end up with “Error: Can't open display: 0.0”
I'm running virtual server Debian/Lenny.
I walked around with by enabling X11 forwarding on client side => ssh -X user@machine_ip.
The xclock shows gently up and and ./RUN_setup.sh brings the promising dialog box for my Java application.
 
Old 04-14-2010, 01:44 AM   #12
propofol
Member
 
Registered: Nov 2007
Location: Seattle
Distribution: Debian Wheezy & Jessie; Ubuntu
Posts: 334

Rep: Reputation: 60
Try this as user:
Code:
export XAUTHORITY=/home/user/.Xauthority
su
xclock
Regards,
Stefan
 
Old 12-09-2010, 05:48 PM   #13
cjcoats
LQ Newbie
 
Registered: Jul 2004
Location: North Carolina
Distribution: Mandrake; Fedora
Posts: 8

Rep: Reputation: 0
Angry Failure under debian lenny

I'm running debian lenny under virtualbox: logged in
as user "foo", open a terminal and "su bar", then try
to use X-based apps.

Tried both the "xhost +localhost" and "setenv XAUTHORITY /home/foo/.Xauthority" (for both 'foo" and "bar"); neither
works (whether alone or in combination).

Never had this kind of trouble in over a decade with
RedHat/Fedora/RHEL, Mandrake/Mandriva, SuSE, PCLinuxOS,
CentOS. Frustrating... and a show-stopper for my using
debian.
 
Old 12-10-2010, 07:31 AM   #14
tethysgods
Member
 
Registered: May 2004
Posts: 166

Original Poster
Rep: Reputation: 17
Does this help at all.

I am sure you have already searched a fair bit, but is this any help?

http://www.xs4all.nl/~zweije/xauth-6.html

"Notice that some X servers (from XFree86) can be configured not to listen on the usual TCP port with the -nolisten tcp argument. Notably the default configuration of Debian GNU/Linux is to disable the X server listening on the TCP port. If you wish to use remote X on a Debian system, you should re-enable this by altering the way the X server is started. Look at /etc/X11/xinit/xserverrc for a start."

I must admit it doesn't mean much to me.
 
1 members found this post helpful.
Old 12-10-2010, 04:16 PM   #15
cjcoats
LQ Newbie
 
Registered: Jul 2004
Location: North Carolina
Distribution: Mandrake; Fedora
Posts: 8

Rep: Reputation: 0
Thanks -- it turned out what I need was in section 7, not 6: Debian locks things down so that you need to jump through hoops with xauth and .Xauthority to have cross-user display on a given machine. This is made easier by a "su" variant called, if you can believe it, "sux" ("su with X").

I had searched a fair bit, but google found so many false positives for my problem that I never got to the "xs4all" howto.

Thanks again -- Carlie
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
only root can open the display for mplayer shobhit Linux - Software 5 06-16-2005 04:34 PM
Can't open display as root dicou Linux - Newbie 7 04-18-2005 03:25 PM
root cannot open display m_yates Linux - Software 7 03-14-2004 11:49 PM
bashrc not read by root, can't open display SerfurJ Slackware 6 12-05-2003 11:54 PM
root user can't open display chr15t0 Linux - General 7 01-28-2003 08:34 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:49 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration