You are not logged in.

#1 2010-03-23 17:23:21

glenn69
Member
Registered: 2007-09-26
Posts: 125

Cannot run gui from command line as root

Using KDE 4.4.  Whenever I try to run a gui application in terminal while logged in as root I get this error:

No protocol specified
: cannot connect to X server :0

I can run the program with kdesu, but I want to run as root instead.  Some applications just don't work right under kdesu ( systemsettings in particular.  I want to add new login themes.  They do not load under kdesu, but do under su....hmmm?)

I ran this as a normal user : DISPLAY=:0.0 xhost +
and was able to run systemsettings after su - with no problem.

I have 2 questions:
1) Why can I not run GUI apps as root?
2) How can I make root able to use X server permanently, as the fix above has to be entered each time I log in.

Thank You

Offline

#2 2010-03-23 17:27:33

Mr.Elendig
#archlinux@freenode channel op
From: The intertubes
Registered: 2004-11-07
Posts: 4,092

Re: Cannot run gui from command line as root

You don't have to su or kdesu to use the system settings and so on afaik. Kde itself have finctionality to grant privs to use them (using polkit)
Atleast that worked for me(tm) when I last used kde4 about 2 months ago.

Last edited by Mr.Elendig (2010-03-23 17:28:22)


Evil #archlinux@libera.chat channel op and general support dude.
. files on github, Screenshots, Random pics and the rest

Offline

#3 2010-03-23 18:07:56

glenn69
Member
Registered: 2007-09-26
Posts: 125

Re: Cannot run gui from command line as root

In KDE 4.4 if I click on System Settings the options to change Login Themes are greyed out with no option to unlock, etc..
I researched the problem and was introduced to the kdesu as a workaround.

Offline

#4 2010-03-23 22:09:38

tavianator
Member
From: Waterloo, ON, Canada
Registered: 2007-08-21
Posts: 858
Website

Re: Cannot run gui from command line as root

KDE sets up access control to only allow the logged-in user to connect to the X server.  To get around this, run "xhost +local:".  Stick it in a shell script in .kde4/Autostart to make it permanent.

Offline

#5 2010-03-23 22:12:42

Misfit138
Misfit Emeritus
From: USA
Registered: 2006-11-27
Posts: 4,189

Re: Cannot run gui from command line as root

tavianator wrote:

KDE sets up access control to only allow the logged-in user to connect to the X server.  To get around this, run "xhost +local:".  Stick it in a shell script in .kde4/Autostart to make it permanent.

This.
Or, if you need to be protected from yourself, use sudo or kdesu.

Offline

#6 2010-03-23 22:47:41

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,772

Re: Cannot run gui from command line as root

I would think very carefully before running a GUI with root permissions.  GUI code is complex and can provide much greater exposure to attacks and nasty bugs.  I do this sometimes -- and I always feel a breeze


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

Board footer

Powered by FluxBB