🔍 See Original Answer on Ask Ubuntu 🔗
Replacing gksudo with pkexec: editor doesn't start in current folder
April 21, 2018
November 24, 2022
Copy to clipboard: false
As mentioned in comments,
gksu was “orphaned” in 16.04 but you can still install it with:
sudo apt install gksu
That said I made a wrapper script for
pkexec a long time ago that might be of some interest:
#!/bin/bash # Usage: gsu gedit file1 # -OR- gsu natuilus /dirname COMMAND="$1" # extract gedit or nautilus ABSOLUTE_NAME=$(realpath "$2") pkexec "$COMMAND" "$ABSOLUTE_NAME" #log-file "$ABSOLUTE_NAME" ~/bin/log-gsu-"$COMMAND"
I named the wrapper
gsu as a short form of
log-file script is a separate project which I commented out in the script for this answer.
You need to setup
nautilus policy kits before you can use this script as the comments reference. In your case you would need to setup a policy kit for
Hope this helps!