Open as administrator in Gnome Files

Opening files and folders in gnome files are as easy as double-clicking on the item. Sometimes we need access to items we don’t have user permission to use. We can easily change this by opening the context menu with a right click and selecting ‘open as administrator’ in Gnome Files

Elevated User Privileges

By default, we don’t have access to files outside of the /home/user directory. This is to help prevent us from changing or deleting files and folders. Changing these can result in a broken functionality or system. There are, however, times when we do need to edit or access these files. Some examples such as:

  • Editing the samba.conf files to change networking settings.
  • Manually editing sources.list for repository changes.
  • Copying themes into /usr/share/themes so they are globally available.

There are countless reasons why you would need access to files outside of the home folder. However, because of the security and design of the OS, it is restricted to user access. To gain access we have to temporary ‘elevate’ our privileges to root. We can do this by issuing sudo commands and entering our user password. We can do this one of two ways firstly we can open Gnome Files from a terminal by entering:

sudo nautilus

Or secondly, we can install a package called nautilus-admin. This will enable the option to open a file or folder as root directly from a ‘normal’ nautilus window.

Isn’t this a built-in feature in Gnome Files?

Gnome Files also known as Nautilus is a Linux file manager based on the gtk3 framework. While being ported to GTK3 from GTK2, it contained many features which were left out during the initial redesign. Some forks of the project such as the Nemo file manager included in the cinnamon desktop already have the ‘open as administrator’ option. Others such as Caja the mate file manager also require a package called ‘caja-admin’ to enable it. Luckily though we can add this feature back in through the python project nautilus-admin. This will provide some administrator functions to the context menu in Nautilus, such as

  • Open as Administrator: opens a folder in a new Nautilus window running with administrator (root) privileges.
  • Edit as Administrator: opens a file in a Gedit window running with administrator (root) privilege

Installing nautilus-admin

Ubuntu / Debian

The nautilus-admin package is not installable from the ubuntu software-center. It can however, be installed by GUI through using the Synaptic package manager. Or directly from a terminal with

sudo apt install nautilus-admin

Don’t forget to restart nautilus afterward with

nautilus -q

Packages are also available to install for Fedora, Arch and other derivatives from their repositories.

Installing from source.

For the brave, the source code can be downloaded from the github page. Here you will find instructions for depandancies and how to compile and install.

Getting Full access to the file system and open as administrator in Gnome Files

Using this tool we can now gain administrator rights to all areas of the filesystem via a graphical interface. This can now be done by right clicking on a folder and selecting ‘open as administrator’ in Gnome Files. Nautilus is an expandable file manager thanks to python extensions with many other options to ease the file management workflow.

Do you have another method of managing and editing system files? Let us know in the comments below.