After upgrading from Ubuntu 16.04 to 18.04, gksu is missing.
— For Ubuntu 20.04 see https://paulshipley.id.au/blog/coding-tips/ubuntu-20-04-gksu-replacement/ —
I recently upgraded my Ubuntu 16.04 machines to 18.04 (a bit late I know – 20.04 is almost here). The upgrade was fairly painless, except for two things: networking (which is another story) and gksu was missing.
Some quick research found that both gksu and gksudo had been removed with Ubuntu 17.10.
What wasn’t clear was what to replace it with; especially as my researches quickly descended into ‘flame wars’ over the merits of the removal and why anyone would want to use these.
The short background appears to be that policy is that rather than giving the entire application root access, only a small ‘helper’ component should have root access and the GUI run with user privileges while it communicates with the helper. Now while this would seem to be ‘best practice’, many still current applications have not yet been rewritten using this methodology and still require a gksu like process to run correctly.
I did come across several alternatives but they were either difficult to use or worked inconsistently. The best alternate I found is to use pkexec to create an alias.
To create an alias permanently add the alias to your .bashrc file
And then add your alias at the bottom.
alias gksu='pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY'
You can now use the gksu alias.