I'm trying to be a good boy and stop using gksudo
, especially since it just got orphaned in the 18.04 daily builds (note, this question is not specific to 18.04).
In the bad old days of using gksudo
, I'd typically navigate to a folder containing the file I wish to edit (I use pcmanfm) then select Tools/Open Current Folder In Terminal from the menu. Then I'd type gksudo leafpad [file-I-wish-to-edit]
in the newly opened terminal.
Using information in the very useful answer How to configure pkexec? I set my .bash_aliases and I am able to now type pkexec leafpad [file-I-wish-to-edit]
in the newly opened terminal and I don't get any errors. Sadly, though I get a blank file instead of what I wanted. I have determined that this is because leafpad is looking in /root
instead of the folder I wished to be in.
How can I maintain my halo, continue to use pkexec
instead of gksudo
, yet retain the functionality I'm used to?
As mentioned in comments,
gksu
was "orphaned" in 16.04 but you can still install it with:That said I made a wrapper script for
pkexec
a long time ago that might be of some interest:I named the wrapper
gsu
as a short form ofgksu
. Thelog-file
script is a separate project which I commented out in the script for this answer.You need to setup
gedit
andnautilus
policy kits before you can use this script as the comments reference. In your case you would need to setup a policy kit forleafpad
.Hope this helps!
I use this alternative in desktop launchers or bash scripts to keep the gksu feel:
... though no pkexec here - pls don't tell my admin.
Use something like
pkexec thunar %f
(thunar is the xfce file manager and%f
is for current path - works with Bionic XFCE just like gksu).