Opening Graphical Application with Root Permission – gksu Alternatives in Ubuntu 18.04

Replace gksu Ubuntu

Recently, Ubuntu 18.04 removed gksu from its repositories, causing panic in anyone who relied on the utility on a regular basis. What many people didn’t realize, though, was gksu hadn’t been maintained in a long time. It was already a dead program. Ubuntu finally just made the move to cut ties with it.

What Did gksu Do?

It’s somewhat strange, actually. Some Linux users never touched gksu. Others used it multiple times a day. It all comes down to how you prefer to manage your computer. Gksu allowed sudo to be used with graphical applications. One of the most common uses was with a text editor like gedit. You could use gksu to open a text document in a graphical editor, like gedit, with full root privileges.

You could use it with other applications like gParted, too. Really, it was the go-to option when you needed to run something graphical as root.

Using GVFS – Recommended

Use gedit gvfs

The recommended method for launching a graphical application now is to use functionality already built in to gvfs, the utility used for managing and mounting filesystems. This will require you to launch your graphical application from the terminal, much like gksu did.

Unlike gksu, this is already built in to GNOME and will simply require that you alter your file path to specify that you’re opening it as an administrator. Opening a file with gedit looks something like this:

This will work with any utility that needs to access a file with root privileges. As long as your program takes the path to a file when it’s launched, you can launch it with admin privileges this way.

Using Su

Use Su for applications

This next option isn’t exactly recommended, and it can be a security risk if used improperly. That said, it’s the most direct way to launch a program as root. Keep in mind, this will launch things as root, not just with root privileges. You should also keep in mind that GNOME and other desktop environments will handle the privileges for you when you launch a utility like gParted through your desktop launcher. This method isn’t strictly necessary for that. In any case, this is still an option.

Start by switching your user to root in the terminal. Make note of the - at the end. That bit makes launching graphical applications possible in most cases.

Now, launch your application.

Just be exceptionally careful and drop root privileges when you’re done.

Both of these techniques are already baked into Ubuntu, and they can make up for everything that gksu did. Remember to be careful when using either one, and don’t ever run graphical applications as root unless you need to. There is absolutely never a reason to run your web browser as root either.

Nick Congleton Nick Congleton

Nick is a freelance tech. journalist, Linux enthusiast, and a long time PC gamer.


  1. I just use a distro that allows an explicit root login. No need to muck around with gksu, su or sudo or whatever.

  2. While you can do everything from the command line, gksu was an incredibly handy tool that will be missed by a lot of people. Maybe maintenance wasn’t being done but is it that big of a deal to keep in in the repository?

  3. “sudo su -” is what I used to do, too, when I wanted to switch my terminal session to root.
    However, I learned that ‘sudo’ can do it without the help from ‘su’ as well:
    “sudo -i” will start a so-called login session to switch you to root. It will, in other words, run the initialisation scripts before it returns control to the (root) user. Most notably, it will change the current directory to the root home directory.
    “sudo -s” will start a subsession to switch you to root. It will not run the initialisation scripts, and it will not change your current directory.
    If you ever run “sudo su -” in the company of a knowledgeable user, they will likely see you as an amateur (as I know from my own experience).

  4. For starting an app with a GUI front end, the preferred replacement is pkexec. IIRC some older versions of distros did not have policykit set up properly, so it might fail on those. Works fine for me with Ubuntu 18.04, LM 18.3 and 19.

  5. Does anyone know how to adjust the timeout period of the superuser password when using admin://?

Comments are closed.