Working in the terminal is fine, but sometimes you’re browsing folders in Nautilus and you just want to right-click a config file and open it as root without typing commands. There used to be a package called nautilus-gksu for this, but it was deprecated years ago and removed from modern Ubuntu releases.
Here’s how to do it now.
Option 1: nautilus-admin (recommended)
The modern replacement is nautilus-admin, a Nautilus Python extension that adds “Open as Administrator” and “Edit as Administrator” to the right-click menu:
sudo apt install nautilus-admin
After installing, restart Nautilus:
nautilus -q
Now right-click any file or folder and you’ll see “Open as Administrator” in the menu. It’ll prompt for your password via pkexec and open a Nautilus window with root privileges.
Option 2: Use the admin:// URI
If you prefer not to install anything, you can type this directly into Nautilus’s location bar:
admin:///path/to/folder
Nautilus will prompt for your password and show the specified folder with root access. It’s not integrated into the right-click menu, but it works without any extra packages.
Enjoy!