Open file or application as root from GUI

70,553

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.

Share:
70,553

Related videos on Youtube

Admin
Author by

Admin

Updated on November 25, 2022

Comments

  • Admin
    Admin 12 months

    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)

  • Admin
    Admin about 10 years
    Can this method be scripted in some way that it consequentially be inserted into context menus?
  • Admin
    Admin about 10 years
    @chrsmrrtt I don't know. It may be possible.
  • Admin
    Admin about 10 years
    please note that gksu is no longer installed per default in Ubuntu >= 13.04 - but it is still available in the repos.
  • jpaugh
    jpaugh over 3 years
    I wish this were a little more specific about what goes wrong with plain sudo... I've done it dozens of times, and survived; I just don't remember how. I think you just have to re-own a specific X.org-related file.