Enable ‘Open as Administrator’ in Ubuntu 21.04 [Quick Fix]

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.

The tutorial will work on:

This tutorial will work on all current Ubuntu releases, including Ubuntu 18.04, Ubuntu 20.04, Ubuntu 20.10, and Ubuntu 21.04. 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 documents, and “Open as Administrator” option for folders.

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:

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

a.) Extension does not work due to module import error:

Running nautilus -q command will output an error message:

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. As a workaround, you can revert the commit. However, there could be some other issue that’s preventing this change from working as expected.


  • Rebuild the gvfs source yourself with a patch to revert the commint.
  • Or downgrade gvfs by installing the package from Ubuntu 20.10.

And here’s how to install the gvfs packages from Ubuntu 20.10:

  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 geek who has been 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.