Gksu in 14.04?

Tom H tomh0665 at gmail.com
Thu Aug 7 09:52:00 UTC 2014


On Wed, Aug 6, 2014 at 6:52 PM, Bob <ubuntu-qygzanxc at listemail.net> wrote:
> ** Reply to message from Tom H <tomh0665 at gmail.com> on Wed, 6 Aug 2014 17:47:34
> -0400
>> On Wed, Aug 6, 2014 at 5:20 PM, MR ZenWiz <mrzenwiz at gmail.com> wrote:
>>> On Wed, Aug 6, 2014 at 1:39 PM, Tom H <tomh0665 at gmail.com> wrote:


>>>> It works with
>>>>
>>>> pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY XDG_RUNTIME_DIR=/tmp nautilus
>
>
> I normally don't run nautilus but do want to run gedit which gets the same
> errors listed below.
>
> I tried the above command line and it does not work on my system.  I get the
> following error.
>
> bob1 at Jupiter:~$ pkexec env DISPLAY=$DISPLAY XAUTHORITY=$AUTHORITY
> XDG_RUNTIME_DIR=/tmp nautilus
> No protocol specified
>
> ** (gedit:23645): WARNING **: Could not open X display
> No protocol specified
>
> (gedit:23645): Gtk-WARNING **: cannot open display: :0
> bob1 at Jupiter:~$
>
> From my testing the only environment variable needed (on my system) is
> XDG_RUNTIME_DIR.
>
> using
> bob1 at Jupiter:~$ pkexec env XAUTHORITY=$AUTHORITY XDG_RUNTIME_DIR=/tmp gedit
> or
> bob1 at Jupiter:~$ pkexec env XDG_RUNTIME_DIR=/tmp nautilus
> I get the following error.
>
> (gedit:23637): Gtk-WARNING **: cannot open display:
> bob1 at Jupiter:~$

How do you get to your X session? xinit, startx, LightDM?

What's the output of "xauth list"?

What's the output of "loginctl show-session <session>"? Where you get
<session> from running "loginctl".


>>>> from a terminal (but not from alt-f2!).
>>>
>>> Thanks again.
>>>
>>> When I first tried pkexec thunar, it failed as Chris described, but
>>> after I ran it with your suggestion above, that worked, and it also
>>> works without the env spec.
>>>
>>> I did find it also interesting that all those variables are already in
>>> my environment, so I'm not sure why it didn't work the first time
>>> without the env... extension added.
>>
>> You're welcome.
>>
>> Those variables are in your environment but in the above command,
>> you're setting them for root.
>>
>> From a security perspective, it'll be better to set something other
>> than "/tmp" as XDG_RUNTIME_DIR. I was just testing and forgot to
>> mention it earlier.
>
> Would XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR work?

No because root would be using "/run/user/<uid>/" and that directory
and its subdirectories are for <uid> only.




More information about the ubuntu-users mailing list