Getting error with your workaround:
Code: Select all
$ echo '/usr/bin/pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY $@' > ~/.local/bin/gksudo;chmod u+x ~/.local/bin/gksudo
bash: /home/johny/.local/bin/gksudo: No such file or directory
chmod: cannot access '/home/johny/.local/bin/gksudo': No such file or directory
gm10 wrote: ⤴Mon Aug 27, 2018 3:43 pmThat gksudo thing is suggested is just a pkexec wrapper. You can name that script whatever you like, I just named it gksudo because that's a command people are used to -- the original gksudo is no longer supported.
Ok, neat. Seems vaguely similar to your trick of creating a user called 'sudo'. I'm starting to see your style
Personally, i'd prolly avoid using existing keywords that way, tho i can see why it makes sense here (since you're used to typing gksudo).
My new analysis
Code: Select all
$ echo '/usr/bin/pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY $@' > ~/.local/bin/gksudo
$ chmod u+x ~/.local/bin/gksudo
- the echo directed to gksudo creates the script called gksudo, and writes your pkexec statement into the script.
- the pkexec statement sets the environment of the script to root, so that config-writes are done in the root home, instead of logged-in user home. (i don't see why that necessary, since pkexec already runs in root env, no?).
- $@ is the gui-app name passed into the script when the script is called.
- chmod gives local user execute-permission.
Hrm,
pkexec man says:
the PKEXEC_UID environment variable is set to the user id of the process invoking pkexec. As a result, pkexec will not allow you to run X11 applications as another user since the $DISPLAY and $XAUTHORITY environment variables are not set.
So does that mean if i do
pkexec thunar
, configs are written to logged-in user, instead of root? So, i could break my thunar that way, same as doing sudo thunar can break thunar?
in Caja and Nemo I can just right click and select to edit as root/administrator without having to run the file browser itself as root.
Handy! i don't see that in Thunar, but wouldn't help anyway, in cases where the user doesn't even have read-access to a certain directory (which i've encountered, maybe cuz i run as Desktop user). Windows (shudder the thought, shutter the Windows) has "run as administrator" option on executables.
xed's admin:// implementation is a crutch, too, with many limitations, but at least you don't need pkexec to run it.
last stupid question (for the next 15 minutes at least): Is xed doing pkexec in the background, for admin://?
THX