While working with files and folders as a Linux Administrator, we frequently need to access and edit files and folders that require root/super-user permissions. We usually perform this task through the Debian Terminal(the command line utility) using the sudo function. However, when we need to edit files that require root privileges through the Graphical Interface, we need to have a solid workaround for that.

The latest versions of Debian, like Debian 10, comes with a default file manager by the name of Nautilus. This open source file manager created for our GNOME desktops gives us a way to manage our files and applications. It also lets us open and edit our files and folders as a Debian administrator. Other features that it provides include:

  • Creating folders and documents
  • Displaying files and folders
  • Searching for and managing files
  • Run scripts and applications as an administrator
  • Install and remove fonts etc.

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

Installing Nautilus-admin

The following steps will help you in installing the Nautilus-admin utility to your Debian system:

Open the Terminal through the Debian Application Launcher search as follows:

Debian Terminal

Run the following command as an administrator:

$ sudo apt install nautilus-admin

Install Nautilus Admin

Enter Y when prompted about the use of additional disk space.

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

Opening a Folder as an Administrator

Let us suppose that you need to open a folder that requires root permission. You can access the folder through the UI file manager(now Nautilus-admin), right-click, and then select 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 admin (root) user

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

Editing a File as Administrator

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

Example:

Let us suppose I want to edit a secure file ‘.pwd.lock’ located at /etc. When I open it through the usual method, I will get the following message:

Could not open file

The workaround is to open the file through Nautilus as follows:

Editing a File as Administrator

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

The Nautilus Admin utility that you learned to install and use through this tutorial will save you from using the Terminal every time you want to access and edit the contents of a secure file or folder on your Debian system.

How to Open and Edit Files and Folders on Debian GNOME Desktop as an Administrator
Avatar

Karim Buzdar

About the Author: Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications. As an IT engineer and technical author, he writes for various web sites. He blogs at LinuxWays.