Enable ‘Open as Administrator’ in Ubuntu 21.04 with Fix [Ubuntu 21.10 Updated]

Want to enable ‘Open as Administrator’ (aka ‘Open as Root’) in your file browser context menu? Here’s the beginner’s guide shows you how with a quick fix for Ubuntu 21.04 & Ubuntu 21.10.

The tutorial will work on:

This tutorial will work on all current Ubuntu releases, including Ubuntu 18.04, Ubuntu 20.04, Ubuntu 21.04, and Ubuntu 21.10. And it’s for the default Nautilus file browser.

1.) Install nautilus-admin extension:

Ubuntu comes with the nautilus-admin package in the main repositories. With it, you’ll get “Edit as Administrator” option for editing documents, and “Open as Administrator” option for opening folders as root.

To install it, press Ctrl+Alt+T on keyboard to open terminal and run command:

sudo apt install nautilus-admin

Tip: For Ubuntu MATE or Linux Mint MATE desktop, there's also a similar package called caja-admin for the Caja file browser.

2.) Restart nautilus to apply change:

After installed the extension, you need to apply change by restarting nautilus via command:

nautilus -q

Or you can just log out and back in. And it should work afterwards.

3.) Fix / Workaround for Ubuntu 21.04 & Ubuntu 21.10:

In Ubuntu 21.04 Hirsute Hippo, there are two issues in my case. If you get into the same problem, here’s the workaround.

a.) Fix nautilus -q error for Ubuntu 21.04

Running nautilus -q command will output an error message in Ubuntu 21.04:

Traceback (most recent call last):
File “/usr/share/nautilus-python/extensions/nautilus-admin.py”, line 25, in
from gettext import gettext, locale, bindtextdomain, textdomain
ImportError: cannot import name ‘locale’ from ‘gettext’ (/usr/lib/python3.9/gettext.py)

This is due to a small change in the Python 3.9 library. To fix it, do the steps below one by one:

  1. Firstly press Ctrl+Alt+T on keyboard to open terminal. When it open, run command to edit the extension script:
    sudo gedit /usr/share/nautilus-python/extensions/nautilus-admin.py
  2. When file opens, find out this line:import os, subprocess and change it into:import os, subprocess, locale
  3. Next find out the line:from gettext import gettext, locale, bindtextdomain, textdomain and remove locale from import.

Finally save the file and restart Nautilus via nautilus -q command.

b.) Workaround for nautilus admin & gedit admin error:

Due to update of the gvfs package, you’ll get an error when using ‘Open as Admin’ action:

GDBus.Error:org.freedesktop.PolicyKit1.Error.Failed: Unix process subject does not have uid set

It’s a bug caused by the commit to fix a network permission issue for flatpak apps. The upstream has fixed the issue by releasing gvfs 1.48.1. However, Ubuntu stuck at version 1.47.91 without a fix.


  • Install gvfs 1.48.1 from a third-party PPA.
  • Or downgrade gvfs by installing the package from Ubuntu 20.10.

Option 1: Install gvfs 1.48.1 from Ubuntu PPA:

Thanks to Panda Jim, who has backported the package from Debian into this Ubuntu PPA with Ubuntu 21.04 and Ubuntu 21.10 support.

Open terminal via Ctrl+Alt+T keyboard shortcut, then run the commands below one by one to add the PPA & upgrade gvfs package:

sudo add-apt-repository ppa:ubuntuhandbook1/gvfs
sudo apt update
sudo apt install gvfs

After that, the ‘Open as Administrator’ function should work at next login.

For any issue, purge the PPA which will also revert the package to the stock version:

sudo apt install ppa-purge && sudo ppa-purge ppa:ubuntuhandbook1/gvfs

Option 2: install the gvfs packages from Ubuntu 20.10:

For those don’t like third-party PPAs though upgrading gvfs is preferred, you can alternatively downgrade the gvfs package to the old 1.46 version.

  1. Firstly, download the .deb packages (for 64-bit system) one by one by clicking the following links:
  2. Secondly, press Ctrl+Alt+T to open terminal and run command to install all downloaded deb packages:
    sudo apt install ./Downloads/gvfs*.deb

Finally restart your machine to apply changes.

That’s it. Enjoy!

Merilyn Ne
Hi, I'm Merilyn Ne, a computer geek working on Ubuntu Linux for many years and would like to write useful tips for beginners. Forgive me for language mistakes. I'm not a native speaker of English.