LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   Cannot start some apps as root (https://www.linuxquestions.org/questions/debian-26/cannot-start-some-apps-as-root-374799/)

davcefai 10-19-2005 04:04 PM

Cannot start some apps as root
 
While running KDE 3.4, if I start a shell and su then if I try to run, say, kwrite or kdar I get:

Code:

Xlib: connection to ":0.0" refused by server
Xlib: Invalid MIT-MAGIC-COOKIE-1 key
kwrite: cannot connect to X server :0.0

If I exit back to normal user, no problem.

If, as su, I run vim it runs OK but when I exit I see the following between my invocation and the new prompt:

Code:

Xlib: connection to ":0.0" refused by server
Xlib: Invalid MIT-MAGIC-COOKIE-1 key
Xlib: connection to ":0.0" refused by server
Xlib: Invalid MIT-MAGIC-COOKIE-1 key
Xlib: connection to ":0.0" refused by server
Xlib: Invalid MIT-MAGIC-COOKIE-1 key

Can anyone help solve this mystery please?

cybrog 10-19-2005 04:19 PM

As user, not root, try this:
Code:

kdesu kwrite
You can try this with other apps.

perfect_circle 10-19-2005 04:58 PM

Your problem is that those apps are Graphical applications and as a user you have X-window running blocking other users application from connecting to the X-server, including root 's applications. Do what cybrog told you. It should work.

yanik 10-19-2005 05:01 PM

anyone have an idea on how to solve the problem instead of the workaround?

nx5000 10-19-2005 08:34 PM

kdesu is not a workaround, it is made for this! :)

Otherwise, after you ve logged in , you could do:
$su -
#ln -s ~user/.Xauthority
#exit

this will be permanent!

davcefai 10-19-2005 11:57 PM

Thanks to all. Both methods worked. Anybody else coming on this thread please note:

They may already be a .Xauthority file in /Root. you need to rename or remove it.

I agree with nx5000 that

Quote:

kdesu is not a workaround, it is made for this!
However one is already root for a reason so kdesu could be tedious. Also this can happen if you're in File Manager - superuser mode and you open a terminal in a directory.

Thanks.

makuyl 10-20-2005 02:18 AM

apt-get install sux and use it instead of su. kdesu is ok of course for kde apps. Don't much use the filemanager so I don't know how to fix that.

reddazz 10-20-2005 03:43 AM

Quote:

Originally posted by makuyl
apt-get install sux and use it instead of su. kdesu is ok of course for kde apps. Don't much use the filemanager so I don't know how to fix that.
kdesu works for any apps not just KDE apps. I usually don't use GUI programs as root, but if I really need to, I just do "xhost +localhost" as a normal user, so that root can execute graphical programs from the terminal emulator. This is not a permanent solution but thats how I like my system.

makuyl 10-20-2005 06:44 AM

sux is more secure than xhost though, and iirc you'd need to export DISPLAY once root. That said, it's what I often use as well ;)

davcefai 10-20-2005 10:10 AM

I thought I was coming off the steep part of the learning curve but now I have my doubts.

The previous 2 posts are food for thought and testing. I've got my system more or less how I like it (although I haven't yet managed to install my NVIDIA card on the new kernel - consider this as advance warning of another question :) ) but I will certainly have a look at the suggestions.

Thanks.

makuyl 10-20-2005 11:12 AM

Well, another way is to add the following lines to roots ~/.profile
export XAUTHORITY=/home/your_username/.Xauthority
export DISPLAY=:0.0

but then use "su -" instead of "su" so the env gets set for root or /root/.profile won't get read.
You can check the right display as user with: echo $DISPLAY

davetesc 01-13-2013 05:39 PM

Ran into this problem with deb testing KDE 7.0 tried alsorts that didn't work.
gksu gparted or whatever app worked.
Then found this thread , the post by nx5000 about using ln -s ~user/.Xauthority worked without me even ahving to reboot.
Thankyou davetesc

John VV 01-13-2013 10:38 PM

davetesc
are you aware that the last post before you was in 2005

things have changed a lot in 8 years

A lot of os's now will not allow root GUI logging in ( some do )

for deb based OS's sudo is normally used to start a gui based program as root


All times are GMT -5. The time now is 01:36 AM.