LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Run as su (https://www.linuxquestions.org/questions/slackware-14/run-as-su-946986/)

ceh383 05-26-2012 09:58 AM

Run as su
 
When I try to run thunar as su I get the following error...

Code:

bash-4.1$ su
Password:
bash-4.1# thunar
No protocol specified
No protocol specified
No protocol specified
No protocol specified
Thunar: Cannot open display:
bash-4.1#


Being a poor typist, this is my preferred way to navigate to files for editing.
The computer is a Dell XPS l702x with dual video (integrated intel and discrete nvidia) running BumbleBee 3.0

I can enter
Code:

export XAUTHORITY=~/.Xauthority
as a user then su and it works. Is there a config file that can be edited so this can be skipped?

And I know running as root is not the best way to go about it, but, It's the way I like to do it...

NoStressHQ 05-26-2012 10:27 AM

Usually you have a tool comming with your wm... For kde it's "kdesu"... It launches a command as root, but setup display so it can use the "user space" xserver (it's a simplification).

You can use kdesu even with other wm comming with slackware, of course, if you've done a full install...

Code:

bash-4.1$ kdesu thunar &>/dev/null &
(You can ommit the redirection and the background parts if you want some verbose/debug...)

EDIT: I haven't tried, but you might even be able to do something like:

Code:

bash-4.1$ kdesu terminal &>/dev/null &
... and launch a 'root' terminal, being able to launch any graphical tool from root... WARNING: I haven't tested that, it needs to be confirmed.

Bests.

414N 05-26-2012 10:32 AM

You can just add a xhost line like the following:
Code:

xhost local:root &>/dev/null
in your ~/.bashrc to allow root opening X windows.

NoStressHQ 05-26-2012 10:37 AM

Quote:

Originally Posted by 414N (Post 4688176)
You can just add a xhost line ...

Neat. Thanks.

ceh383 05-26-2012 11:45 AM

Quote:

Originally Posted by 414N (Post 4688176)
You can just add a xhost line like the following:
Code:

xhost local:root &>/dev/null
in your ~/.bashrc to allow root opening X windows.

That worked, thank you...

GazL 05-26-2012 04:05 PM

Quote:

Originally Posted by 414N (Post 4688176)
You can just add a xhost line like the following:
Code:

xhost local:root &>/dev/null
in your ~/.bashrc to allow root opening X windows.


Just a word of caution on this one. The "local:" family option on xhost ignores the username so the above would open the xserver up to any local user, not just root. If you're running a desktop machine it's probably not a big deal, but if you want to keep things tighter, you can use the following instead.
Code:

xhost +si:localuser:root

Ilgar 05-27-2012 02:28 AM

Did you try
Code:

su -
instead of "su"?

414N 05-27-2012 03:10 AM

Quote:

Originally Posted by GazL (Post 4688384)
Just a word of caution on this one. The "local:" family option on xhost ignores the username so the above would open the xserver up to any local user, not just root. If you're running a desktop machine it's probably not a big deal, but if you want to keep things tighter, you can use the following instead.
Code:

xhost +si:localuser:root

Thanks for the advice!


All times are GMT -5. The time now is 11:32 PM.