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
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.
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.