Add ‘Open as Administrator’ to Pantheon in Elementary OS Luna

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):

sudo apt-get install gedit

sudo gedit /usr/share/contractor/scratch-openasroot.contract

2. Copy and paste below lines into the file and save it.

[Contractor Entry]
Name=Open file as root
Description=open file as root with scratch
Exec=gksudo scratch-text-editor %U

This will add an option “Open file as root” to Pantheon context menu, which open text files as root user with Scratch Text Editor (the default editor for eOS).

Open folders as root in Panthen Context Menu:

1. Use your favorite editor to create and edit the config file:

sudo gedit /usr/share/contractor/folder-openasroot.contract

2. Copy and paste below lines into the file and save it.

[Contractor Entry]
Name=Open folder as root
Description=Open current folder as root privilege
Exec=gksudo pantheon-files %U

This adds the option ‘Open folder as root’ to context menu, which open folders as root privilege.

Remember, you need a restart to get things done. Enjoy!

By Ji m

I'm a freelance blogger who started using Ubuntu in 2007 and wishes to share my experiences and some useful tips with Ubuntu beginners and lovers. Please comment to remind me outdated tutorial! And, notify me if you find any typo/grammar/language mistakes. English is not my native language. Contact me via Buy me a coffee:


  1. You might want to add this to your list of items for the right click menu.

    How to add “delete permanetly” option to File’s context menu.
    command:sudo gedit /usr/share/contractor/Delete.contract
    copy and paste into empty file;
    [Contractor Entry]
    Name=Delete permanetly
    Description=Delete files, skip trash
    Exec=rm -r

    I could not find this anywhere, so created it. If there is a better way, let me know.
    Thanks and have a nice day.

Comments are closed.

Exit mobile version