Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
In nautilus or some other file manager? – Braiam Jan 26 '14 at 15:28

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
share|improve this answer
I think you can make this Nautilus Script applicable to files as well by replacing nautilus with xdg-open – Sadi Jan 28 '14 at 12:09
@Sadi very good proposal indeed, I will edit it. now i am on mobile. – souravc Jan 28 '14 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 '14 at 7:58
@bob thanks for pointing it out. I should mention it explicitly. – souravc Jan 29 '14 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
 More info:
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

share|improve this answer
Please don't post screenshots of your terminal. Paste the commands directly into your answer instead. – terdon Mar 13 '14 at 2:33
up vote 2 down vote accepted

You can do that in many ways:

1.login as root nautilus as a root

gksu nautilus

3.You can add "Open as administrator" as an extension to your right click:

i-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

64 bit- Direct link from

ii-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/ /usr/lib/nautilus/extensions-3.0

iii-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/ /usr/lib/nautilus/extensions-3.0  
share|improve this answer
sudo nautilus /path/to/folder/
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.