How to open and edit files and folders on the Debian GNOME desktop with administrator rights

When working with files and folders as a Linux administrator, we often need to access and edit files and folders that require root / superuser privileges. We usually do this task through the Debian Terminal (command line utility) using the sudo function. However, when we need to edit files that require superuser privileges through the GUI, we must have a reliable workaround for this.

Recent versions of Debian like Debian 10 come with a default file manager called Nautilus. Built for our GNOME desktops, this open source file manager gives us the ability to manage our files and applications. It also allows us to open and edit our files and folders as a Debian administrator. Other features it provides include:

  • Create folders and documents
  • Displaying files and folders
  • Search and manage files
  • Run scripts and applications as administrator
  • Install and uninstall fonts, etc.

However, this file manager does not provide an efficient way to open and edit protected content as root. This way, we will install the Nautilus Admin utility which helps the administrator / authorized user to easily open secret files and folders.

Installing Nautilus-admin

The following steps will guide you to install the Nautilus-admin utility on your Debian system:

Open Terminal by searching for Debian Application Launcher as follows:

Run the following command as administrator:

$ sudo apt install nautilus-admin

Install Nautilus Admin

Enter Y when prompted to use additional disk space.

Nautilus Admin will be installed on your system. Now, whenever you open the file manager, you actually open the nautilus-admin utility.

Opening a folder as administrator

Let’s say you need to open a folder that requires root privileges. You can access the folder through the file manager of the user interface (now Nautilus-admin), right-click and choose Open as administrator from the menu.

Example:

In this example, we want to access the root folder from other locations. Since this folder requires root privileges, we will access it as follows:

Open file as administrator (root)

You will be prompted to provide authentication information, after which you can access the contents of the folder.

Editing a file as administrator

If you want to edit a file, such as a system configuration file, that requires root privileges, the Nautilus-admin file manager allows you to edit that file as an administrator. You just need to access this file, then right click and select Edit as administrator from the menu.

Example:

Suppose I want to edit a protected .pwd.lock file located in / etc. When I open it in the usual way, I get the following message:

Can not open the file

A workaround is to open the file through Nautilus like this:

Editing a file as administrator

After providing the authentication data, you will be able to access and edit the contents of the file.

The Nautilus Admin utility, which you learned how to install and use with this guide, will save you from using the Terminal every time you want to access and edit the contents of a protected file or folder on your Debian system.

How to open and edit files and folders on the Debian GNOME desktop with administrator rights

Sidebar