Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Can't run X app (k3b) while su'ed as root...
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Duplicate Threads
View previous topic :: View next topic  
Author Message
cayenne
l33t
l33t


Joined: 17 Oct 2002
Posts: 945
Location: New Orleans

PostPosted: Thu Jun 24, 2004 2:56 am    Post subject: Can't run X app (k3b) while su'ed as root... Reply with quote

Hi all,

I recently upgraded my kernel to 2.6, and KDE to 3.2. It seems now, that while as my normal user, but, su'ed into root, I can no longer run x applications.

As my local user, I did xhost +localhost. However, when I try to run a program as root, I get the following error:

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

k3b: cannot connect to X server :0

[1]+ Exit 1 k3b

Any ideas what I'm doing wrong here?

TIA,

cayenne
_________________
Light travels faster than sound. This is why some people appear bright until you hear them speak.........
Back to top
View user's profile Send private message
Shan
Guru
Guru


Joined: 04 Nov 2003
Posts: 558
Location: /dev/null

PostPosted: Thu Jun 24, 2004 3:04 am    Post subject: Reply with quote

You've got to run it as yourself, with root privs. Try this instead

Code:
su -c `command`


Please note -c stands for command
also note the BACKTICS (not quotes). You'll be asked for the root password, and then the program should execute.
_________________
{ NO -U } { STRIP }
{ TINY }
Back to top
View user's profile Send private message
Plastic
l33t
l33t


Joined: 24 Mar 2004
Posts: 649

PostPosted: Thu Jun 24, 2004 4:52 am    Post subject: Reply with quote

Run
Code:
xhost local:root

before you su
Back to top
View user's profile Send private message
Shan
Guru
Guru


Joined: 04 Nov 2003
Posts: 558
Location: /dev/null

PostPosted: Thu Jun 24, 2004 5:02 am    Post subject: Reply with quote

Plastic wrote:
Run
Code:
xhost local:root

before you su


You could put this in your .bashrc or such too if you wanted it to be persistent right? Though it would probably invalidate whatever reason they had to make it currently prevent root from launching X apps eh?
_________________
{ NO -U } { STRIP }
{ TINY }
Back to top
View user's profile Send private message
Rafixus
n00b
n00b


Joined: 06 Jan 2003
Posts: 67

PostPosted: Fri Jun 25, 2004 5:55 am    Post subject: Reply with quote

For temporary X usage from root, you could also

Code:

cp /home/<your user>/.Xauthority /root


then you can run all the needed apps as root and X won't complain
Back to top
View user's profile Send private message
soujirou
Apprentice
Apprentice


Joined: 22 Jun 2004
Posts: 205
Location: sweden

PostPosted: Fri Jun 25, 2004 11:18 am    Post subject: Reply with quote

im trying to run xscreensaver when im root
it starts if i use xhost local:root but when im in it it pops up an dialog "couldnt write /root/.xscreensaver" how do i fix this ?
Back to top
View user's profile Send private message
Shan
Guru
Guru


Joined: 04 Nov 2003
Posts: 558
Location: /dev/null

PostPosted: Fri Jun 25, 2004 11:55 am    Post subject: Reply with quote

Maybe Im mis-interpreting what your saying but why are you logged into X as root? Its not neccisary and poses a large secuirty risk (as well as increases the danger of screwing up by a whole lot)
_________________
{ NO -U } { STRIP }
{ TINY }
Back to top
View user's profile Send private message
soujirou
Apprentice
Apprentice


Joined: 22 Jun 2004
Posts: 205
Location: sweden

PostPosted: Fri Jun 25, 2004 12:09 pm    Post subject: Reply with quote

........................ well yes... didnt solve the problem though :?
Back to top
View user's profile Send private message
Shan
Guru
Guru


Joined: 04 Nov 2003
Posts: 558
Location: /dev/null

PostPosted: Fri Jun 25, 2004 12:25 pm    Post subject: Reply with quote

soujirou wrote:
........................ well yes... didnt solve the problem though :?


My point was to AVOIDE the problem all together. Maybe your new to the Linux world and don't realize this, but running as root (especially as in an X environment) is a Bad Thing(TM) and should be avoided at all costs.

Use "su -" or "sudo" instead, both methods allow you to run x apps as well.
_________________
{ NO -U } { STRIP }
{ TINY }
Back to top
View user's profile Send private message
soujirou
Apprentice
Apprentice


Joined: 22 Jun 2004
Posts: 205
Location: sweden

PostPosted: Fri Jun 25, 2004 12:33 pm    Post subject: Reply with quote

okej
Back to top
View user's profile Send private message
pjp
Administrator
Administrator


Joined: 16 Apr 2002
Posts: 20067

PostPosted: Mon Aug 02, 2004 7:49 pm    Post subject: Reply with quote

https://forums.gentoo.org/viewtopic.php?t=9109
_________________
Quis separabit? Quo animo?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Duplicate Threads All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum