How do I start Nautilus as root?

How to run Gedit AND Nautilus as administrator with pkexec instead of gksu or gksudo

GVfs method tested in Ubuntu 18.04

Use the GVfs admin backend, just add admin:// to the beginning of the full path to your preferred directory.

Open Nautilus the usual way and press Ctrl+L to enable typing in the address-bar, and then enter for example admin:///usr/ to open the /usr/ directory.

Enter your admin password when prompted and you will see something like this:

enter image description here

At this point clicking on the folders with locks will open with admin privileges.

You may bookmark a folder that is opened with admin:/// prefix. When you click on such a bookmark later you may be prompted for the admin password again.

Alternatively, from the Terminal open nautilus with the argument admin:///usr/:

nautilus admin:///usr/

to open the /usr/ directory as root in Nautilus.

Editing text files with admin privileges

From Nautilus opened in this way, if you click on a text file that needs admin privileges, you will be prompted for password again, before it opens in your default editor such as Gedit.

If you are using Ubuntu 17.10

The following method does not work with Wayland by default. There are some workarounds. The easiest one is not to use Wayland. How do you switch from Wayland back to Xorg in Ubuntu 17.10? Other alternatives are described in Why don't gksu/gksudo or launching a graphical application with sudo work with Wayland?

Ubuntu will switch back to Xorg by default in 18.04 LTS and the workarounds will not be needed then.

Original answer

Source: WebUpd8

gksu hasn't been updated since 2009 and is not recommended any more. In fact, Ubuntu no longer ships with gksu by default (though it may be installed for many of you, because some apps still depend on it) and it may even be completely removed at some point.

Nautilus admin adds PolicyKit files for both Nautilus and Gedit and it allows opening a file or folder from Nautilus as root, via PolicyKit:

To install Nautilus Admin in Ubuntu, open a terminal by pressing Ctrl+Alt+T and use the following command:

sudo apt-get install nautilus-admin

And to restart Nautilus use either of the following commands:

nautilus -q or killall nautilus

After this when you right click on a folder you will see:

enter image description here

If you right click on a text file editable by Gedit you will see:

enter image description here

Then you will be prompted for password:

enter image description here

Related question: "Open in terminal" not working on nautilus as root

Finally, installing nautilus-admin also allows opening nautilus as root from the command line. Use the following command instead of gksu or gksudo:

pkexec nautilus 

to open nautilus as root.

Hope this helps


Try:

gksudo nautilus

Then type your own password just like when using sudo.

Gksudo man page: http://linux.die.net/man/1/gksudo