LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Run kde apps as superuser? (https://www.linuxquestions.org/questions/linux-newbie-8/run-kde-apps-as-superuser-51565/)

J_Szucs 03-24-2003 09:41 PM

Run kde apps as superuser?
 
Can I start kwrite as superuser from kde?
I try to run it from xterminal (after su -l) but I only get an error message:
Cannot connect to xserver

I wonder why, since so far as I remember I could do this in Blackbox.

newbieME 03-25-2003 12:14 PM

did you try to go to under k menu, run application and start kwrite from there? but that wouldn't start the app in super user mode though...you can just log in as root and run it but i am sure there are other&better ways to do it...

twan 03-25-2003 02:00 PM

i would recommend you not to use the root login to often

too dangerous to fuck it all up. Almost everyone uses a 'user' login here..

but if you don't believe then you'll just learn it the hard way ;)

mhearn 03-25-2003 05:01 PM

Use kdesu,

kdesu kwrite

but as pointed out, using root for gui apps is rare.

FYI, the reason you get that error is because only the user you logged in as can display things to the screen normally unless you do some security related stuff.

moaltmann 03-25-2003 06:56 PM

.Xauthority is the key
 
Dear J_Szucs: before using my script below consider whether it is in fact necessary for you to use kwrite. There are many text-only replacements (e.g. editor) which support basic text editing too.
newbieME: i am sorry, but your suggestion to logon KDE directly as root is among the worst as this completely exposes the system when most of the time a simple su will do.
personal recommended solution: below you find a shell script which is fairly simple and does not compromise on your system security. I named it mysu to make it clear that it is not the simple su command, though one could alias it to replace the su command. The script has to be placed in any directory included in $PATH and must me marked executable (e.g. chmod a+x mysu)

# /usr/local/bin/mysu
# script allowing su to access X-server from logged-in non-root user
# for feedback (i am really a newbie) mischa.delete-this-part@altmann.at

# point $XAUTHORITY to current user's .Xauthority file
# .Xauthority stores authorization keys for X-system of current user
# $XAUTHORITY is an environmental variable pointing to the file
# containing keys. If it doesnt exist X defaults to $HOME/.Xauthority
XAUTHORITY=$HOME/.Xauthority

# let new processes inherit environment variable $XAUTHORITY
export XAUTHORITY

# login as superuser (su)
su

# remove "export attribute" from $XAUTHORITY
export -n XAUTHORITY

I hope this helps,
. Mischa Altmann

newbieME 03-26-2003 08:05 AM

Quote:

Originally posted by moaltmann
newbieME: i am sorry, but your suggestion to logon KDE directly as root is among the worst as this completely exposes the system when most of the time a simple su will do.
thus the statement

Quote:

Originally posted by newbieME
there are other&better ways to do it...

Who 03-26-2003 11:28 AM

Here's how I do it on KDE:

alt+F2 gets me a RunCommand dialog. I can enter "kwrite" as the program to run, then expand the Options and choose "Run as a Different User," username is 'root' and enter the password for that user. Now I'm in kwrite with root permissions. I can't think of any reason why this would make problems.


All times are GMT -5. The time now is 08:23 PM.