If you’re tired of having to jump through hoops to open files with sudo privileges in the GNOME File Manager, Jack Wallen has just the trick you need.
Not all Linux file managers are created equal. Some file managers have more bells and whistles than the average user will ever need, while other file managers are as inflexible as cold, hard steel. There are also those that ship with a bare minimum of features but allow users to extend the feature set with add-ons.
Given how we so often take the file manager for granted, once you find a feature that could really make your daily life a bit more efficient, you realize just how important the tool is. Such is the case with the GNOME File Manager. Out of the box, it works great and includes enough features to get you by for a while. Eventually, however, you’ll find some features that could make things a bit easier.
One such feature is the ability to open files with sudo privilege without having to jump through extra hoops.
Let me set the stage for you. As it ships, to open a file with sudo privileges, you have to do the following:
- Open GNOME Files.
- Navigate to the directory housing the file in question.
- Right-click an empty spot inside the directory.
- Click Open in the terminal.
- Issue the command (including sudo) to open the file with elevated privileges.
That’s a bit extra. And when you’re having to do this over and over throughout the day, it can become a serious waste of time.
SEE: 40+ open source and Linux terms you need to know (TechRepublic Premium)
Fortunately, there’s a way to add an Edit as Administrator entry to the Files right-click context menu, so you don’t have to go through all of those steps. The one caveat to this is that if you’re opening text files, it will open in the default Gedit — or GNOME Text, depending on which version of GNOME you’re using — GUI application.
If you prefer editing such files in the terminal window, the more cumbersome route is still your best bet. But for those who want more efficiency out of their file manager, let’s fix this glaring omission.
What you’ll need
The only things you’ll need to make this work are a running instance of any Debian-based Linux distribution that uses the GNOME file manager and a user with sudo privileges. The one caveat to this is that there is no way to do this on an RHEL-based distribution such as Fedora without using a tool like beesu, which allows you to open the file manager with sudo privileges and doesn’t make the process any more efficient.
With that said, let’s get this up and running on my go-to Linux distribution, Pop!_OS.
How to install the necessary extension
Before we add this extension, please use it with caution. Once you’ve installed this tool, you make it easier for other people to open important configuration files with ease. Do this only if you trust those who’ll be using your desktop.
With that out of the way, log in to your desktop and open a terminal. From that window, issue the command:
sudo apt-get install nautilus-admin -y
Once the installation completes, restart Nautilus with the command:
How to use the new extension
Open Nautilus and navigate to a file you want to open that requires root access, such as /etc/samba/smb.conf. Right-click that file and you should now see a new entry in the Nautilus aka GNOME Files context menu, named Edit As Administrator (Figure A).
After typing your user’s sudo password, the Gedit — or whatever GUI text editor you’ve set as your default — will open the file with write permissions. Edit the file as needed, save it and you’re done.
Thanks to this handy addition to the GNOME File Manager, your work day can be made considerably easier. Give nautilus-admin a try and see if you don’t quickly come to depend on the newly-added feature.
Subscribe to TechRepublic’s How To Make Tech Work on YouTube for all the latest tech advice for business pros from Jack Wallen.