Ubuntu 18.04 removed the gksu package entirely from its repositories.
The rational behind this is that gksu is thought to be used only in this way:
gksu gedit /some/root/setting
But there are other usages of gksu as well. Gksu is an important program because unlike sudo or graphical programs like pkexec it prevents other programs from stealing focus.
So when you want to type your password using simple cli sudo, and some chat window pops up, what happens is that the password is entered into the chat window (if you don't look at the screen for a moment), and your root password is sent to you chatting buddy. It happened to me once and I don't want it to happen ever again.
This is why gksu is ideal security wise, and I use it often at command line level. So not to launch gedit, but to do command line stuff, e.g. apt-get update && apt-get upgrade or execute some bash scripts.
And no, pkexec is not an alternative to gksu, because 1) it does not execute scripts, only binaries and 2) it doesn't prevent other programs from stealing focus.
Secondly, you can also use gksu to ask for non-root passwords in a secure manner. For example:
ccrypt -K `gksu -p --message "Password:"` -d data.tar
So my question is: what program can be used as an alternative to gksu in these cases?
This answer deals only with
gksu gedit
and nothing else.Besides the disappearance of
gksu
with Ubuntu 17.10, I've had long standing problems where my regular user settings for font name, font size, tab stops, convert tabs to spaces, etc. were never carried over tosudo
/gksudo
and I'd always have to reset them.Furthermore
sudo
gets no top-level menu for editing preferences.The script I wrote not only allows
gksu
-like usage withgedit
but also copies my usergedit
preferences over to thesudo
account.You will need to change one line of code:
This positions the window
1
pixel right and1220
pixels down. You might prefer1+1
instead of1+1220
.The window size is set to
1300
pixels wide by840
pixels high. You might prefer a smaller or larger size depending on Monitor resolution and HiDPI. So change1330x840
to your preferences.Create the bash script somewhere in your path and mark it as executable using:
Then to call it use:
instead of the old system of:
HTH