> I’ve just loaded OpenSuSe 11 and have a similar problem. sudo gedit
> … results in “cannot open display”. The fixes listed here don’t seem
> to work for me.
Due to increased security concerns, the Xorg server does not accept
connections from users other than whomever started it. This can be
To enable ‘sudo xxx’ to work:
and edit the line starting with ‘Defaults env_keep = "LANG…’
add DISPLAY within the quotes
(there is a second occurrence of this line a few lines down, it’s commented
out and can be ignored)
This change causes the DISPLAY variable to be retained, and only needs to be
You need to tell (ask?) the X server to accept connections from other users
(root in this case) by running:
This disables access controls and allows any user to connect to the
currently running X server. No, not very secure, but if you’re the only
user on a machine, it’s acceptable. I tried with ‘xhost +localhost’ and
variants, no luck.
The ‘xhost +’ command must be executed at least once per session, so once
it’s run, you needn’t do it again unless you log out.
No, it’s not really a ‘simple fix’… but you’re trying to defeat
security… and with that in mind, it’s appropriate that it’s not simple.
A better solution (which I use) is to ‘su - root -c xxx’, which will prompt
you for root’s password, then run whatever command. This doesn’t subvert
security, and allows you to use the power of root to perform tasks.
you could of course alias that command:
alias xsudo=‘su - root -c’
xsudo gedit xxx
would do what you desire.
L R Nix