How to get "gksudo"-command again or alternative

Hi altogether,

how do I get my old “gksudo”-command back in Lubuntu 20.04.2?

I looked it up on Ubuntu – Package Search Results -- gksu and it seems the package “gksu” was last available for xenial.

When previuosly using Lubuntu bionic I still could get it back with the command sequence

  sudo add-apt-repository ppa:mark-pcnetspec/gksu 
  sudo apt update
  sudo apt install gksu

. But having a look at gksu : Mark-pcnetspec I get the impression gksu is only available for bionic now.

So what can I do when using Lubuntu focal?
What if I want to use GUI applications with root privileges? :question: People say “don´t use sudo for GUI apps”. That´s done with “gksudu”.

Any help is highly appreciated.

Many thanks in advance.

Rosika :blush:

  1. gksu was entirely removed from the Debian and Ubuntu repositories. It was not maintained anymore.
  2. It is a very bad idea to run a graphical program with elevated privileges. And in most cases, it is absolutely not necessary.
  3. Please explain your use case and then we can give you better alternatives.
2 Likes

Hi @apt-ghetto,

thank you very much for your reply.

  • when the need arises to modify a certain config file which needs root privileges to be handled and I want to use a graphical text editor (like gedit).
    Well, I know the answer to this one: “sudo nano […]” in the terminal.

  • what about this one: copying files from “/” to “/home/rosika/[…]” within a graphical file-manager (like thunar) and two tabs open.
    O.K., this can be done via terminal as well: “sudo cp […]” :wink:

  • But what if I want to use grub-customizer (Grub Customizer in Launchpad ).
    This is definitively a GUI application and as far as I know it needs root privileges. :thinking:

Thanks again for your help.
Many greetings.
Rosika :slightly_smiling_face:

Editing files with a graphical editor is a very good example of a case, where the editor itself does not need to run with elevated privileges.
If you have the admin:// backend installed (for example, when you use GNOME, doesn’t work on Lubuntu), then you should be able to edit files with:

gedit admin:///path/to/file

In general the better solution is to use sudoedit:

VISUAL=gedit sudoedit /path/to/file

If you always use the same graphical editor, you can add export VISUAL=gedit to your ~/.bashrc, close the terminal and reopen it.
Then you only need

sudoedit /path/to/file

In both cases, the editor is not running with elevated privileges.

It depends on the file permissions. Usually, you can copy files from / without problems. If the file manager is running with normal user privileges, the copied files will also have the correct permissions and owners.

If you are running the file manager with elevated privileges, the copied file in your ~ will have root as owner.

If your file manager needs elevated privileges to copy files from another location to your home folder, than the files are quite special.

If a graphical application really needs elevated privileges, it usually has a PolicyKit action. In the case of grub-customizer it is /usr/share/polkit-1/actions/net.launchpad.danielrichter2007.pkexec.grub-customizer.policy and you should be able to start it with

pkexec grub-customizer
5 Likes

@apt-ghetto :smile:

Hi again,

thank you so much for you very detailed explanation. :hearts: :+1:

I didn´t even know of the existence of sudoedit.
Curious as I am I looked it up with locate sudoedit and indeed found it here:
/usr/bin/sudoedit .

echo $VISUAL yielded nothing on my system. So I think

should be fine. :blush:

O.K. If I´m not completely mistaken that was the case once or twice but I cannot recall what files I was dealing with at the time. All I know is that due to permissions lacking I couldn´t copy the respective files from within the file-manager.
But in those rare cases I can certainly do the action from within the terminal. :wink:

Taking a look at PolicyKit actions with ll /usr/share/polkit-1/actions/ I was astonished to see how many programmes and apps have an entry there.
I have to admit I didn´t know about that either. Thanks for letting me know. :smile:

So the pkexec command will come in handy when really needed.

Many thanks again for your help. It´s highly appreciated. :+1:

BTW:
About a week ago I´ve done a clean install of Lubuntu 20.04.1 (which has become 20.04.2 by now as I noticed).
Previously I was using Lubuntu 18.04 but a clean/fresh install was needed bcause of the change of DE.
In the meantime I´ve grown accustomed to LXQt and I really like it very well.

Thanks again and keep safe.
Many greetings from Rosika :slightly_smiling_face:

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.