gksu Removed From Ubuntu, Here's The Recommended Replacement

Ubuntu 18.04 no gksu

The gksu package, which provides GTK+ front-ends for su (gksu) and sudo (gksudo), was removed from the Ubuntu 18.04 repositories (and Linux Mint 19 Tara), so it won't be available starting with this Ubuntu release.

gksu is used to allow elevating your permissions when running graphical applications, for example in case you want to run a graphical text editor as root to edit a system file, or to be able to remove or add a file to a system folder.

How to edit system files using a GUI without gksu?


Enter admin://. The recommended way of performing operations that require elevated permissions using a GUI is by using the gvfs admin backend, which is available in both Ubuntu 18.04 LTS (and Linux Mint 19 Tara) and 17.10, by using the admin:// prefix.

All you have to do is open Nautilus (or Nemo), press Ctrl + L so you can type in its address bar, and type admin:// followed by the path of the folder containing the file you want to edit, and enter your password. After doing this, you can use any GUI application to alter system files, like Nautilus to add / delete files or folders, Gedit (or Xed in Linux Mint 19) to edit text file, and so on.

admin instead of gksu ubuntu

Here's an example. Let's say you want to edit the Grub file. Instead of using gksu gedit /etc/default/grub, you can open Nautilus / Nemo and type: admin:///etc/default. You'll be asked for your password and after you enter it, you can open the grub file with Gedit (or Xed in Linux Mint 19), then save it.

Note that there are 3 forward slashes after admin: because 2 are required by default and the 3rd is from the path that follows, which begins with a slash: /etc/default. One more thing: in Nautilus, don't enter the direct path to a file but to a folder containing the file you want to edit.

In the same way you can run Gedit from a terminal to open a system file and edit it, for example:

gedit admin:///etc/default/grub

This will prompt for your password and then open the file in Gedit, allowing you to edit it.

9 comments:

  1. Or you can do the old same way.....

    pkexec yourprogram......

    This will behave like straight old gksudo.

    For the die-hard old-timers, you can creat an alias to pkexec named gksudo. It will do.

    ReplyDelete
    Replies
    1. For pkexec, you need policy files or else you cannot use it. For instance, you can get policy files for Nautilus by installing nautilus-admin.

      Delete
  2. If you like gksu you can use an alias. You can see the answer here: https://askubuntu.com/a/1045252/752945

    ReplyDelete
    Replies
    1. That's nice and probably the best solution if they would have included this by default in Ubuntu, but I don't see the point if it requires an extra step from the user... you can just use admin instead.

      Delete
    2. sometimes you want to do remote admin on the machine then gksudo-like commands come in handy.

      Delete
  3. where from can i install gksudo from ppa?

    ReplyDelete
    Replies
    1. gksu is not recommended any more (you should use admin:// as explained in the article) but if you really really want to install it from a PPA, here is one that has gksu for Ubuntu 18.04 / Linux Mint 19: http://launchpad.net/~mark-pcnetspec/+archive/gksu

      Delete
  4. How can run applications that don't try and access a file then? For example, gksu pm-suspend. I have this binded to my keyboard and I would like to enter in the password in a graphical way without going into a terminal emulator.

    ReplyDelete
    Replies
    1. Since you're not trying to run a graphical application (which would require a polkit file for each such app when used with pkexec), you can use pkexec directly:

      pkexec pm-suspend

      Delete

Powered by Blogger.