This tutorial shows beginners how to add ‘Open as Administrator’ option in Nautilus file browser context menu (right-click menu) in Ubuntu 19.10.
Want to open a file folder and/or edit a file via root user account? Without running Linux command, you can do this by adding ‘Open as Administrator‘ or ‘Edit as Administrator‘ right-click menu option via nautilus-admin extension.
1.) The nautilus-admin package is available in Ubuntu universe repository. Simply open terminal either from application menu or by pressing Ctrl+Alt+T on keyboard.
When terminal opens, run command to install it:
sudo apt install nautilus-admin
Type user password (no asterisk feedback) for sudo prompt and hit Enter.
2.) Once installed the extension, restart Nautilus file browser via command:
Next time you open the file browser, you’ll see ‘Open as Administrator‘ context menu option for file folders, and ‘Edit as Administrator‘ option for documents.
This simple tutorial will show you how to add ‘Open As Root’ or ‘Open As Administrator’ option to context menu so that you can easily edit / open file folders as super user privilege within Nautilus file browser.
There’s now a Nautilus extension (see the link) adds administrative actions to Nautilus context menu. It’s easy to install and supports for all current Ubuntu releases.
To get started:
1. Open Ubuntu Software Center. Search for and make sure the package gksu is installed. gksu allows graphical programs to ask a user’s password to run program as root / administrator.
2. Open Nautilus file browser, press Ctrl+H to view hidden files & folders. Navigate to USER Home -> .local -> share -> nautilus -> scripts.
Create an empty document under this directory named ‘open-as-administrator’ or ‘open-as-root’
3. Edit and paste following lines into the file
# this code will determine exactly the path and the type of object,
# then it will decide use gedit or nautilus to open it by ROOT permission
# Determine the path
if [ -e -n $1 ]; then
base="`echo $NAUTILUS_SCRIPT_CURRENT_URI | cut -d'/' -f3- | sed 's/%20/ /g'`"
# Determine the type and run as ROOT
if [ -f "$obj" ]; then
gksu gedit "$obj"
elif [ -d "$obj" ]; then
gksu nautilus "$obj"
4. Press Ctrl+Alt+T to open the terminal. When it opens, run the command below to make executable:
cd .local/share/nautilus/scripts/ && chmod 0755 open-as-administrator
5. Finally restart Nautilus via command nautilus -q, or just log out and back in.
This simple tutorial will show you how to add ‘Open as Administrator’ or ‘Open as root’ to Pantheon Context menu in Elementary OS Luna. So that you can easily open system files or folders with super user privilege through the default Pantheon file browser.
First take a look at the screenshots:
open file as root in elementary os
open folder as root in elementary os
Before getting started, search for and install gksu from Software Center. It is a Gtk+ frontend allows graphical programs to ask a user’s password to run another program as root / administrator.
Open files as root in Panthen Context Menu:
It’s a little different to Ubuntu Nautilus. Because I don’t know how to use if conditional statements in ‘.contractor’ files, so I divided this into two parts: Open files as root and Open folders as root.
1. Use your favorite editor to create and edit the config file. Here I use gedit (press Ctrl+Alt+T to open terminal for running commands):