LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices

Reply
 
Search this Thread
Old 10-19-2005, 04:04 PM   #1
davcefai
Member
 
Registered: Dec 2004
Location: Malta
Distribution: Debian Sid
Posts: 764

Rep: Reputation: 32
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?
 
Old 10-19-2005, 04:19 PM   #2
cybrog
Member
 
Registered: Oct 2005
Location: Earth
Distribution: Slackware 10.2
Posts: 60

Rep: Reputation: 15
As user, not root, try this:
Code:
kdesu kwrite
You can try this with other apps.
 
Old 10-19-2005, 04:58 PM   #3
perfect_circle
Senior Member
 
Registered: Oct 2004
Location: Athens, Greece
Distribution: Slackware, arch
Posts: 1,783

Rep: Reputation: 52
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.
 
Old 10-19-2005, 05:01 PM   #4
yanik
Member
 
Registered: Oct 2003
Location: Montreal Beach
Distribution: Debian Unstable
Posts: 368

Rep: Reputation: 30
anyone have an idea on how to solve the problem instead of the workaround?
 
Old 10-19-2005, 08:34 PM   #5
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 52
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!
 
1 members found this post helpful.
Old 10-19-2005, 11:57 PM   #6
davcefai
Member
 
Registered: Dec 2004
Location: Malta
Distribution: Debian Sid
Posts: 764

Original Poster
Rep: Reputation: 32
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.
 
Old 10-20-2005, 02:18 AM   #7
makuyl
Senior Member
 
Registered: Dec 2004
Location: Helsinki
Distribution: Debian Sid
Posts: 1,107

Rep: Reputation: 53
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.
 
Old 10-20-2005, 03:43 AM   #8
reddazz
Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 73
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.
 
Old 10-20-2005, 06:44 AM   #9
makuyl
Senior Member
 
Registered: Dec 2004
Location: Helsinki
Distribution: Debian Sid
Posts: 1,107

Rep: Reputation: 53
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
 
Old 10-20-2005, 10:10 AM   #10
davcefai
Member
 
Registered: Dec 2004
Location: Malta
Distribution: Debian Sid
Posts: 764

Original Poster
Rep: Reputation: 32
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.
 
Old 10-20-2005, 11:12 AM   #11
makuyl
Senior Member
 
Registered: Dec 2004
Location: Helsinki
Distribution: Debian Sid
Posts: 1,107

Rep: Reputation: 53
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
 
Old 01-13-2013, 05:39 PM   #12
davetesc
LQ Newbie
 
Registered: May 2012
Location: UK
Distribution: Debian testing KDE, Mint 14 XFCE, Ubuntu Studio
Posts: 19
Blog Entries: 4

Rep: Reputation: Disabled
Thumbs up

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
 
Old 01-13-2013, 10:38 PM   #13
John VV
Guru
 
Registered: Aug 2005
Posts: 12,603

Rep: Reputation: 1677Reputation: 1677Reputation: 1677Reputation: 1677Reputation: 1677Reputation: 1677Reputation: 1677Reputation: 1677Reputation: 1677Reputation: 1677Reputation: 1677
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
cant start X apps using su or sudo slinky2004 Linux - Newbie 3 11-30-2005 08:14 PM
No root access to apps. ioannisss Suse/Novell 8 07-25-2005 01:52 PM
Ruuning QT apps as su root? predator.hawk Slackware 2 10-24-2004 03:19 PM
start apps automatically on start up? chunlee Linux - Newbie 3 09-04-2004 12:58 PM
Running apps as non-root bestmehr Linux - General 1 08-14-2003 11:52 PM


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

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration