|
OpenBSD General Other questions regarding OpenBSD which do not fit in any of the categories below. |
|
Thread Tools | Display Modes |
|
|
|||
can't open display error
This is something I guess of very basic unix knowledge, but until now I have not found an answer (also because I can live with it and maybe did not look that hard for it).
The situation: I usually work as a user which is in the wheel group, if I use this user to login as a different user (even root), if I try to use an application that uses graphics I get this error: Code:
# xpdf Error: Can't open display: Why is it? How can I go around this? I've read quite a few thread on the web, and if I got the point it has to do with some permission policy, but could not really understand the essence of the problem. Could anyone explain in a comprehensible way or point me to a good tutorial? |
|
||||
hi gosha, A common reason that can happen is that when you switch over to the new login, the DISPLAY environment variable is not set. Graphics app's need that variable to know what X display to connect to. So the fix would be simple, just set the variable with something like (for sh-type shells)
$ export DISPLAY=:0.0 or whatever the appropriate DISPLAY was before you switched users. Note: some ways of logging in will automatically set DISPLAY for you and the problem won't happen. |
|
|||
actually, before posting I did try the export DISPLAY thing, but then I get this:
Code:
Xlib: connection to ":0.0" refused by server Xlib: No protocol specified Error: Can't open display: :0.0 |
|
|||
ok, never mind, I got it working with this:
$ xhost +local:root run as the user that started X. But now a more general question: if root is allowed to do "anything", why does it need a special permission from a normal user to use its display? |
|
|||
If you have Gnome you have the command gksudo to run graphical apps as root in the current users environment. kdesu is the same for KDE.
|
|
|||
You shouldn't be running X clients as root.. the fact that the X server disallows root when running as a user is a good thing.
|
|
||||
Actually depending on how you are running things, I believe root should be able to give him/her self access to the display without user intervention -- but it would not be polite
__________________
My Journal Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''. |
|
|||
Booo at TerryP, that's like saying your boss should be allowed to come into your office and drink your coffee.
He can.. but he'll die trying. |
|
|||
I got the points, I sometimes forget about the risks of running apps as root.
Thanks |
|
||||
I meant 'should' as in technically should be possible, not 'should' as in should be allowed to do so :-P
__________________
My Journal Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''. |
|
|||
thanks for the suggestion, but I use neither gnome nor kde. I'll be fine with the xhost command and actually follow bsdfan666, that is, don't run apps as root
|
|
|||
you can use xsu instead of gksudo/kdesu gosha.
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
dwm status bar won't display apm output | asemisldkfj | General software and network | 6 | 16th August 2009 11:07 PM |
How do I display Beastie next to the startup menu? | troberts | FreeBSD General | 2 | 7th December 2008 02:16 PM |
Odd font display | TerryP | Feedback and Suggestions | 4 | 2nd November 2008 11:22 AM |
Terminal display behavior | 18Googol2 | FreeBSD General | 8 | 26th September 2008 02:05 PM |
How do I display icons in Thunar? | troberts | FreeBSD Ports and Packages | 2 | 18th September 2008 11:05 AM |