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.
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:
Run the following command as an administrator:
$ sudo apt 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.
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:
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.
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:
The workaround is to open the file through Nautilus as follows:
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.