How To Add ‘Open folder as Root’ In Elementary OS Right Click Menu

Question: How can I create right menu context that open folders as root in Elementary OS.


Answer: To create ‘Open folder as root’ context menu command we need to create a .contract at the location below:


To create this file,

Open your favourite text editor and copy and paste the code below into it:

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

Save it as openasroot.contract and move to /usr/share/contractor:

sudo mv openasroot.contract /usr/share/contractor/

For vi users,

just run:

sudo vi /usr/share/contractor/openasroot.contract

then paste the code above.

And, you’re done!