classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view


Jim Price-4
Having been annoyed enough about the removal of gksu from Ubuntu 18.04 I
finally got around to doing something about it. Can anyone comment on
whether this has the same security issues that caused gksu to be
removed? As it just does stuff you could do from the command line I
would hope not. I should point out that I don't use one of the standard
Ubuntu desktops so I'm only doing this to get around a problem for me
and my disappointment with the googled solutions.

Anyway, at the risk of a lesson in egg sucking, here it is (only 4 lines
of actual code!). Instructions for scripts for Ubuntu 18.04 to run a lot
like gksu:

Create a script called gksu.sh and put it in <path-to>
~/bin as <path-to> is good, as that gets added to $PATH by default

#! /bin/bash
# Run argument as root with prompt for password
# note: only 1 argument supported
export SUDO_ASKPASS=$HOME/bin/askpass.sh; sudo -A "$PROGNAME"

Make it executable.

This is going to call another script called askpass.sh:

#! /bin/bash
# Get a password and return it on stdout
PW=$(zenity --password --title="Password for user $USER" --timeout=10)
echo $PW

Make it executable.

Now set up a launcher with the following command:

<path-to>gksu.sh <progname>

e.g. for synaptic:

/home/jim/bin/gksu.sh synaptic

or from the command line, to run a program with elevated permissions:

gksu.sh <progname>

It could also be renamed to remove the .sh, so it is even more like gksu.


[hidden email]