I want to have a root privileges on some directories. How can I do this?

  • 1
    In nautilus or some other file manager?
    – Braiam
    Jan 26, 2014 at 15:28

4 Answers 4


Create a simple nautilus script can also open a folder as root.


Save the above script as Open folder as root in your ~/.gnome2/nautilus-scripts/. On right click you will have an option under scripts, Open folder as root. And you can open a folder as root after providing your root password.

Do not forget to give the script execution permission. You can use in terminal,

chmod +x ~/.gnome2/nautilus-scripts/Open\ folder\ as\ root

Or you can right click on the file, then go to Properties >> Permissions and check the box corresponds to Execute to give the script execution permission.

enter image description here

enter image description here

To use gksudo you need to install gksu. In Ubuntu 13.04 onwards it is not install by default. You can install it using,

sudo apt-get install gksu

Open files and folders as root

There is a nice application xdg-open which can open any arbitrary file or URL in the user's preferred application. One can replace nautilus with xdg-open in the above script and it will enable one to open folders as well as all files as root.[Proposed by Sadi] It increases the applicability of the code. The modified script will look like,

# script_name: open as root
  • I think you can make this Nautilus Script applicable to files as well by replacing nautilus with xdg-open
    – Sadi
    Jan 28, 2014 at 12:09
  • 1
    @Sadi very good proposal indeed, I will edit it. now i am on mobile.
    – sourav c.
    Jan 28, 2014 at 12:54
  • easy & nice script souravc, just note you have to change file properties to allow execution (for those who do not know it).
    – bob
    Jan 29, 2014 at 7:58
  • @bob thanks for pointing it out. I should mention it explicitly.
    – sourav c.
    Jan 29, 2014 at 8:02

My solution is to add an option for “Open as Administrator” to directories.

As you can see, there is no “Open as Administrator” option when you right click on a folder:

Screenshot of right-click menu

First, add the package repository by opening your Terminal and typing:

$ sudo add-apt-repository ppa:noobslab/apps

A message will appear:

You are about to add the following PPA to your system:
 This PPA Contains Applications for Ubuntu/Linux Mint from different sources but debianized by http://www.NoobsLab.com
 More info: https://launchpad.net/~noobslab/+archive/apps
Press [ENTER] to continue or ctrl-c to cancel adding it

Press Enter.

Now we’ve added the repository, it’s time to update our sources:

$ sudo apt-get update

After you update, it’s time to install the package we want for our issue:

$ sudo apt-get install open-as-administrator

Finally, you should restart Nautilus:

$ nautilus -q

And now the “Open as Administrator” option should appear:

Screenshot of right-click menu


You can do that in many ways:

  • Log in as root

  • Open nautilus as a root

    gksu nautilus
  • You can add "Open as administrator" as an extension to your right click:

    1. Download the nautilus-gksu package for your architecture from either of these 2 locations, and save it in your downloads folder.

      32 bit: Direct link from ubuntu.mirror.cambrium.nl

      64 bit: Direct link from ubuntu.mirror.cambrium.nl

    2. On your 64 bit install downloaded nautilus-gksu_2.0.2-5ubuntu2_amd64.deb & extracted right in your Downloads folder

      sudo cp ~/Downloads/nautilus-gksu_2.0.2-5ubuntu2_amd64/usr/lib/nautilus/extensions-2.0/libnautilus-gksu.so /usr/lib/nautilus/extensions-3.0
    3. On your 32 bit install downloaded nautilus-gksu_2.0.2-5ubuntu2_i386.deb & again extracted in Downloads folder so terminal command

      sudo cp ~/Downloads/nautilus-gksu_2.0.2-5ubuntu2_i386/usr/lib/nautilus/extensions-2.0/libnautilus-gksu.so /usr/lib/nautilus/extensions-3.0  
sudo -H nautilus /path/to/folder/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy