How to open and edit files and folders in Ubuntu Desktop as administrator

When working with files and folders as a Linux administrator, we often need to access and edit files and folders that require root privileges. Usually we perform this task through the Ubuntu terminal (command line utility) using the sudo function. However, when we need to edit files that require superuser rights through a graphical interface, we must find a reliable solution for this.

Recent versions of Ubuntu, such as Ubuntu 18.o4 LTS, come with a default file manager called Nautilus. Created 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 an Ubuntu administrator. Other features it provides include:

  • Create folders and documents
  • Display files and folders
  • Search and file management
  • Run scripts and applications as administrator
  • Install and remove fonts, etc.

Fortunately, my version of Ubuntu, Ubuntu 18.04, comes with this utility by default; You can install it by following the steps in the next section.

Nautilus Installation

The following steps will help you install the Nautilus file manager on your Ubuntu system:

Open Terminal through Ctrl + Alt + T or through the Ubuntu dash.

Run the following command as administrator:

$ sudo apt install nautilus-admin

Install Nautilus

To come in Y when prompted to use additional disk space.

Nautilus will be installed on your system. You can verify this by introducing Nautilus in Ubuntu Dash as follows:

Nautilus is now a file manager in Ubuntu

The file manager on your system is now Nautilus.

Opening a folder as administrator

Suppose you need to open a folder that requires root permission. You can access the folder through the file manager of the user interface, right-click and select “Open as administrator” in the menu.

Example:

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

Open Nautilus

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 an administrator

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

Example:

Suppose I want to edit a protected evm file located in / sys / kernel / security. When I open it in the usual way, I will receive the following message: Failed to open warning file

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

Change as administrator

After providing the authentication data, you can view and edit the contents of the file.

The Nautilus file manager that you learned to install and use in 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 Ubuntu system.

How to open and edit files and folders in Ubuntu Desktop as administrator

Sidebar