How to Open Files and Folders as Administrator in Nautilus File Manager in Linux

Learn to add an “Open as Administrator” option in the right click context menu in Nautilus file manager in Ubuntu and other Linux distributions.

If you want to open or edit a file as root, you can always do that in the terminal. I know a few people don’t feel too comfortable with the command line.

The desktop Linux often provides ways to avoid the command line for terminal-fearing people.

If you are in a situation where you have to access a folder as root or edit a file with root privilege, you can do that graphically in Nautilus file manager.

A neat Nautilus hack allows you to open files and folders as administrator, i.e. root. Let me show you how.

Add ‘open as administrator’ option in right click context menu in Nautilus file manager

A word of warning! Please don’t go around opening and editing random files as root as you might mess up with wrong files and end up with a broken system. Use it only in the cases where it is required.

I am showing the installation steps for Ubuntu. You can change it as per your distribution’s package manager.

You’ll have to use terminal (even if you don’t like it) for installing the Nautilus plugin. Please make sure that you have the universe repository enabled:

sudo apt install nautilus-admin

Close and open Nautilus file manager again to see the changes in effect.

Open Folder As Administrator Ubuntu
Right click to see the “Open as Administrator” option

You can also edit files as root the same way. Just select the file, right click on it and choose the “Edit as Administrator” option.

Edit Files As Root Ubuntu
Edit Files As Root Ubuntu

In both cases, you’ll be prompted to enter your account’s password:

Authentication Pop Up Ubuntu
You need to enter your password, of course

That’s pretty much it. You can enjoy the comfort of GUI.

In case you don’t want to run Nautilus as root anymore, you can remove this plugin. It’s always good to remove additional things you installed but you don’t use anymore.

In the terminal (yes, again), use the following command to remove the Nautilus plugin.

sudo apt remove nautilus-admin

By the way, if you are using Ubuntu MATE, you can use caja-admin, instead of nautilus-admin. Other file managers may or may not provide such a feature.

I hope you find this quick tip helpful. Questions and suggestions are always welcome.

Similar Posts

  • Hi! Thanks. This works well in Ubuntu 20.10 but in 21.04, it is not working. Is there any method to make it work in Ubuntu 21.04?

  • One detail, it didn’t work for me right away after closing and opening the nautilus windows, I had to run the command nautilus -q in the terminal, and now it works! Thanks for the tutorial.