You are not logged in.
Pages: 1
Hi, whenever I run an application using the sudo I get the following:
cannot open display
I've setup X following the wiki and the install is recent with kde 4.14.10. but I am thinking maybe some configuration is not proper, do you have any advice?
Previously I was running into a different error which named the display 0:0. I fixed by adding the follwing line to my
/etc/sudoers
file using
visudo
:
Defaults env_keep="DISPLAY"
Defaults env_keep="XAUTHORITY"
Defaults env_keep="HOME"
I have attempted different solutions mentioned on the web, to no avail.
For gksudo:
(gksudo:31935): Gtk-WARNING **: cannot open display:
I tried
xhost +
which is simply not recognized as a command (and in any case would be a security issue).
I also tried to copy
./Xauthority
to
/root/
which also didn't work and also added
session optional pam_xauth.so
to
/etc/pam.d/su
and it didn't work.
Also, please, no hurt, no kill!
Last edited by navi_se (2015-07-17 22:18:56)
Offline
Offline
I simply have
sudo 1.8.13-1
so I am just doing, e.g.,
[user@pc ~] $ sudo geany
Geany: cannot open display
Last edited by navi_se (2015-07-17 20:59:37)
Offline
You really shouldn't try to open a graphical application with just sudo. Which desktop are you running?
If I learned how to read, I would know that it's KDE. Have you tried kdesu?
Last edited by Buddlespit (2015-07-17 21:05:43)
Offline
You mean DE? I have KDE 4.14.10 (was in my first post, altough not very visible I guess, changed it now).
Why shouldn't I use sudo to run GUI app? The problem is a lot of time an application will fail , bc it has to write files which under regular use are protected, hence the need to run the application as a root/privileged user.
Also, I have the same problem if I do
su
su -
to login as root.
Last edited by navi_se (2015-07-17 21:06:42)
Offline
Yes, and I get similar results:
QXcbConnection: Could not connect to display IP:0.0
Aborted (core dumped)
Offline
OK, you can't log in as root, either? Good, we're making progress.... Have you read this?
https://wiki.archlinux.org/index.php/Sudo#kdesu
Offline
OK, try this... Log out of KDE and into a console or tty, then type:
$ sudo rm /home/username/.Xauthority
and then reboot the computer. .Xauthority will be recreated when you log back into KDE.
Every time you use sudo to run a graphical app, you'll change .Xauthority to root ownership. Always use a graphical su (kdesu/gksu), which will hide your .Xauthority in tmp
Offline
No, I can login as root just fine and do anything but lunch gui apps. Both via
su
or in a separate tty terminal or at the login (login manager is XDM).
Setting
[super-user-command]
super-user-command=sudo
gives me no changes.
Offline
Ok, it does work (it launches the application)! Thanks! I was used to ubuntu where you'd just sudo the app to make it work with root privileges.
Last edited by navi_se (2015-07-17 21:31:12)
Offline
Offline
Pages: 1