How to Enable Open as Administrator for Ubuntu 13.10 Nautilus

Last updated: October 7, 2013

This quick tip is going to show beginners how to add ‘open as administrator’ or ‘open as root’ into Nautilus context menu in Ubuntu 13.10 Saucy.

With this feature enabled, you can quickly open files and folders in Nautilus with root (super user) privilege. This also works on Linux Mint 16 Petra if you’re using Nautilus 3.8.x.

Open as Administrator ubuntu 13.10

To get started:

1. Open Ubuntu Software Center, search for and install gksu. It 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’

3. Open this file with Gedit, copy and paste following codes into the file and save.

# 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"

exit 0

4. Right-click on this file, go to Properties -> Permissions tab. Check the box which says ‘Allow executing file as program’.

Log out and back in, or restart Nautilus by nautilus -q command. Done.


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 let me know if the tutorial is outdated! And, notify me if you find any typo/grammar/language mistakes. English is not my native language. Contact me via Buy me a coffee:

5 responses to How to Enable Open as Administrator for Ubuntu 13.10 Nautilus

  1. Hmm… Its unfortunate, but isn’t this script depreciated thanx to them taking gksu out? Its still in the repos, and your step 1 is to install it, but it would be nice to have a script that didn’t require us to install depreciated (and unmaintained) packages.

  2. Also after you create the file open-as-admin change its chmod to 0755 or the file will be locked up and you won’t be able to open as root, Do this,
    – Press Ctrl + Alt + T to open up a Terminal window,
    – type cd .local/share/nautilus/scripts/ and press enter
    – type chmod 0755 open-as-admin (or whatever the filename) and press enter

  3. Really useful, thank you. It’s great to have this easily available (although Linux Mint 16, which I also use, has it on the folder right-click context menu…).

    I can’t believe gksu is being deprecated when all the texts in the WORLD say you should use it to start root editors, etc. I am a relative newcomer to Linux, although experienced in computing generally, and I can understand how people find it difficult to get their head around it – in this case it’s OK to use gksudo (but not gksu), for instance! [No, don’t bother posting to tell me the difference, I really don’t want to know]. And after ages of using “sudo -i”, I’ve just discovered that “sudo su” plus password gives you a root terminal with your “environment” PATH intact so you can execute programs without typing the whole ruddy filepath – why didn’t someone SAY?


  4. I cannot believe how difficult it is to use pkexec! Quote “You can’t run graphical applications via pkexec without explicitly configuring it to do so”. And I think you have to configure it separately for each application! Yet another way of trying to make sure that Linux can only be used by the initiated elite inner circle.

    Stick with gksu. If it’s not compliant it should be made a wrapper for pkexec.