Is it possible to open a file or application as root from the GUI?

My ideal would be right-clicking on a file or an application and seeing an "Open as Root" choice in the context menu, after which I was asked for my root password.

Somewhat related to this is the ability to allow, for example, a save to take place where originally you had not opened the application as root (e.g., modifying a .conf file in /etc)


To run GUI applications with elevated permissions, you can use the gksu command:

You can check to see if it's installed with which gksu and if so it will output the path to the command. If not you can install it with the command sudo apt-get gksu

$ gksu nautilus           # browse files as root
$ gksu gedit /etc/fstab   # edit file as root

This command is a frontend to the su and sudo commands, designed for running graphical programs, so it is used the same way as them. See the man page for more information.

  • Can this method be scripted in some way that it consequentially be inserted into context menus? – chrsmrrtt Oct 19 '13 at 19:13
  • @chrsmrrtt I don't know. It may be possible. – user54813 Oct 19 '13 at 19:15
  • 5
    please note that gksu is no longer installed per default in Ubuntu >= 13.04 - but it is still available in the repos. – Takkat Oct 19 '13 at 19:19

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.