How to Edit Files as Root in Ubuntu using GUI File Manager

Learn the way to edit text and other files on Ubuntu as a root user using Nautilus GUI File Manager without the help of the Command Terminal. The tutorial is valid for all Ubuntu versions such as 22.04, 20.04, and 18.04…

What is Nautilus?

Nautilus is the default file manager of the GNOME desktop environment including in Ubuntu. Nautilus Filemanager features include creating and managing files, previewing selected file types, and accessing remote shares. In addition, it has an interface for extensions, which allows for expanding the range of functions.

Apart from clicking on the File Manager icon, users can open it by typing nautilus in the command terminal. Also, by default, Nautilus does not display hidden files. With the keyboard shortcut Ctrl + H, hidden files can be displayed and hidden again.

However, one function which will not be there is to edit system files as root or sudo user directly from the graphical interface of the Nautilus file manager on Ubuntu. However, there is a way to do that. This will not save user time but also allow users to edit system files without messing around using the command terminal.

 

Steps to edit files as root or sudo user in Ubuntu Nautilus File Manager

The tutorial is not just limited to Ubuntu only. Any other Linux that is based on Ubuntu or Debian using Gnome/Nautilus as the default user interface can follow the commands given in this tutorial.

1. Open Command terminal

I can understand you might be wondering here we are talking about GUI File Manger then what is the need to use Command terminal. It is because we need to install a feature that is required by the Nautilus. Also, updating the system using the command line is an easy way. To open Terminal, the users either can use the keyboard shortcut that is Ctrl+Alt+T or search for the same using the application launcher.

 

2. Update Ubuntu Linux

It is good practice if you run the system update command before installing any software. Yes, we need to install an extension for our Nautilus File Manager to get a feature that let us edit files as root. Hence, let’s first update the system.

sudo apt update && sudo apt upgrade

 

2. Install the Nautilus Admin extension

As with other file managers, right-clicking a file or folder opens a context-sensitive menu. The same goes for Nautilus with operations such as copying, moving, moving to the trash can, compressing, etc. offered but not the one to edit files as a Super Admin user. Therefore to integrate that, run the given command:

sudo apt install nautilus-admin

 

3. Reboot your Linux system

Once you have installed the Admin feature for your Nautilus File manager, reboot your system to properly integrate it.

sudo reboot

 

4. Edit files as root via Nautilus GUI File Manager

Open your File Manager and navigate to a file that can only be edited using the rights of root users. After that right click on that file and in the Context Menu this time, you will see an additional optional “Edit as Administrator”.

As you click on the option, the system will ask for your sudo user password, provide that.

Here we are editing the system’s Sources.list file that is only accessible by the user with root rights.

Edit files as root user using GUI File manager Ubuntu

 

5. Remove Edit files as a root feature on Ubuntu

Well, in case you don’t want this Admin feature enabled on your Ubuntu, then we can remove the Admin extension from our Nautilus File manager using the command.

sudo apt remove --purge nautilus-admin

 

Other Articles:

How to reset Ubuntu 22.04 LTS root password
Set root user password in Ubuntu 20.04 LTS focal fossa
How to open Ubuntu file manager as a  root user
How to install GUI File Manager Nautilus on WSL -Windows

 

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.