Gksu in 14.04?

Bob ubuntu-qygzanxc at listemail.net
Thu Aug 7 20:52:03 UTC 2014


** Reply to message from Tom H <tomh0665 at gmail.com> on Thu, 7 Aug 2014 05:52:00
-0400

> 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?

I don't know.  Whatever was setup for the default install of Ubuntu.


> 
> What's the output of "xauth list"?

bob1 at Jupiter:~$ xauth list
Jupiter/unix:0  MIT-MAGIC-COOKIE-1  bf0a79bf30875ec14b3f749964568cb6
bob1 at Jupiter:~$ 


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

bob1 at Jupiter:~$ loginctl
   SESSION        UID USER             SEAT            
        c2       1000 bob1             seat0           

1 sessions listed.
bob1 at Jupiter:~$ 
bob1 at Jupiter:~$ loginctl show-session c2
Id=c2
Timestamp=Sat 2014-07-19 15:37:50 PDT
TimestampMonotonic=29576905
DefaultControlGroup=systemd:/user/1000.user/c2.session
VTNr=7
Display=:0
Remote=no
Service=lightdm
Leader=1252
Audit=0
Type=x11
Class=user
Active=yes
State=active
KillProcesses=no
IdleHint=no
IdleSinceHint=0
IdleSinceHintMonotonic=0
Name=bob1
bob1 at Jupiter:~$ 


> >>>> 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.

OK

-- 
Robert Blair




More information about the ubuntu-users mailing list