Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
run x programs 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
afrodocter1
n00b
n00b


Joined: 16 Jan 2007
Posts: 49

PostPosted: Thu Nov 08, 2007 2:17 pm    Post subject: run x programs as root. Reply with quote

i am trying to run x programs as root under a normal user's X-session. i get the following.

Code:
xterm
Warning: This program is an suid-root program or is being run by the root user.
The full text of the error or warning message cannot be safely formatted
in this environment. You may get a more descriptive message by running the
program as a non-root user or by removing the suid bit on the executable.
xterm Xt error: Can't open display: %s
xterm:  DISPLAY is not set


when i am su into root and the same when i sudo xterm
Code:
 sudo xterm
Warning: This program is an suid-root program or is being run by the root user.
The full text of the error or warning message cannot be safely formatted
in this environment. You may get a more descriptive message by running the
program as a non-root user or by removing the suid bit on the executable.
xterm Xt error: Can't open display: %s
xterm:  DISPLAY is not set


i have tried
Code:

xhost +
xhost +localhost


and it does not help. now xhost yields.
Code:
 xhost
access control disabled, clients can connect from any host
INET6:localhost
INET:localhost
Back to top
View user's profile Send private message
di1bert
l33t
l33t


Joined: 16 May 2002
Posts: 963
Location: Oslo, Norway

PostPosted: Thu Nov 08, 2007 2:27 pm    Post subject: Reply with quote

It's probably your DISPLAY environment variable. Do echo $DISPLAY as your
normal user and then export that output as root

eg:

Code:

export DISPLAY=":0.0"


That should do it, along with the xhost stuff...

HTH

-m
Back to top
View user's profile Send private message
afrodocter1
n00b
n00b


Joined: 16 Jan 2007
Posts: 49

PostPosted: Mon Nov 12, 2007 5:10 pm    Post subject: Reply with quote

the problem was that i used
Code:

DISPLAY=":0.0"

instead of
Code:

export DISPLAY=":0.0"


although i still get an error if i using the following set up, which i think should work.

Code:

> xhost  -             
access control enabled, only authorized clients can connect
> xhost  +localhost
localhost being added to access control list
> sudo su
dong alex # echo $DISPLAY
localhost:0.0
dong alex # xterm
Warning: This program is an suid-root program or is being run by the root user.
The full text of the error or warning message cannot be safely formatted
in this environment. You may get a more descriptive message by running the
program as a non-root user or by removing the suid bit on the executable.
xterm Xt error: Can't open display: %s


 
Back to top
View user's profile Send private message
timeBandit
Bodhisattva
Bodhisattva


Joined: 31 Dec 2004
Posts: 2719
Location: here, there or in transit

PostPosted: Mon Nov 12, 2007 6:47 pm    Post subject: Reply with quote

See this thread.
Or this one.
or this one,
or this one (which also mentions why sudo su is wrong),
or this one,
or even this.... :wink:
_________________
Plants are pithy, brooks tend to babble--I'm content to lie between them.
Super-short f.g.o checklist: Search first, strip comments, mark solved, help others.
Back to top
View user's profile Send private message
think4urs11
Bodhisattva
Bodhisattva


Joined: 25 Jun 2003
Posts: 6659
Location: above the cloud

PostPosted: Mon Nov 12, 2007 7:00 pm    Post subject: Reply with quote

Moved from Desktop Environments to Duplicate Threads.

for alternatives see above
_________________
Nothing is secure / Security is always a trade-off with usability / Do not assume anything / Trust no-one, nothing / Paranoia is your friend / Think for yourself
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