How to open files as root via a right click

How to easily add a context menu item that enables a Linux user to open files as the root user or administrator when browsing their file system using nautilus. This feature allows the user to navigate their file system and open or edit any file or directory as the root user or admin of the system. It is a perfect solution for those that are not completely comfortable using terminal commands.

Note: This tutorial assumes your using a Debian based system and will be utilizing nautilus. Systems such as Ubuntu or another Debian based derivative should work. An Ubuntu Live CD was used for this tutorial. In addition, if your attempting this on a Full Blown Debian installation, you will first need to make sure your user has been added to the sudoers list.

Add a menu to Right Click Open Files as Root

How to easily add a contextual menu item that enables you to Open files as Administrator with a simple right click selection.

  1. Open the Terminal
    Opening a Terminal
  2. Type sudo su and press enter.
  3. Provide your password and press enter
  4. Then type apt-get install -y nautilus-admin and press enter
  5. Now type nautilus -q and press enter
  6. Finally type exit and press enter, and close the terminal window

All set. Now when you want to open a file as root, simply right click the folder and select Open as Administrator.

Pro Tip: You may need to logoff and then log back in to see the changes!

Right Click Open Files as Root Administrator


Right Click Open Files as Root (Administrator)

You also have the option to Edit Files as Administrator using a right click.

Right Click Edit File as Admin