Allen Guarnes

Resolving the missing ‘gksu’ command in Ubuntu 18.04

Disclaimer: I’m actually using Lubuntu 18.04, so there may be slight differences depending on which Ubuntu flavor you’re using.

Starting from Ubuntu 18.04 (or maybe some version after 16.04), the ‘gksu’ package was completely removed from Ubuntu’s repositories. I have no idea why and when, and I might not really care that much as to how they arrived with the decision to remove it, so I’m not going to talk about it because it’s not really important [to me].

Anyhow, minutes of searching Google led me to using the old ‘pkexec’ command. The problem with this is that policy files have to be made, otherwise an error would be displayed. I think it was something along ‘cannot be displayed’. But I needed to use ‘pkexec’ command on both leafpad and pcmanfm, so I made the following files to fix the issue:

These files should be saved to /usr/share/polkit-1/actions.

After adding those, you should already be able to run the following:

pkexec leafpad <file_path>

or

pkexec pcmanfm <directory_path>

without any issues whatsoever.

Both files are here: https://gist.github.com/allenguarnes/f309c26642b7ad506c77d5eb8897e052

Custom PCManFM Actions for Lubuntu 18.04

My old custom PCManFM actions no longer work because gksu is gone so I needed to fix that too.

To do that, I did the following steps.

P.S. I do not claim these to be the best solution. Feel free to comment if there is an easier way to accomplish these.

Open terminal and change the directory.

cd /usr/bin

Copy the file synaptic-pkexec as our template, otherwise skip these steps and just create the file and permissions manually on your own.

sudo cp synaptic-pkexec leafpad-pkexec
sudo cp synaptic-pkexec pcmanfm-pkexec

Edit leafpad-pkexec and pcmanfm-pkexec:

Then add these files to ~/.local/share/file-manager/actions:

All the files are here: https://gist.github.com/allenguarnes/c64d2cd8cc4ae05d766096cfafcf8b8b

If someone has a better way, please do tell!

1 Comment

  1. Works great on Arch Linux Too!

Leave a Reply