How to run programs as root user without using Terminal

I want to run the programs as root user without using the terminal command line, is that possible to do like that? if yes tell me please. Thanks.


If you want to run programs without using Terminal, I can deduce that you mean only GUI programs. And each one from all these GUI applications have in general an .desktop file located in /usr/share/applications/ or in your user directory ~/.local/share/applications. So to start a program as root you must to edit or better duplicate its associated .desktop file.

Let's take for example Gedit, the default GUI editor in Ubuntu. Its .desktop file is /usr/share/applications/gedit.desktop and has the following content:

[Desktop Entry]
Name=gedit
GenericName=Text Editor
Comment=Edit text files
Exec=gedit %U
Terminal=false
Type=Application
StartupNotify=true
MimeType=text/plain;
Icon=accessories-text-editor
Categories=GNOME;GTK;Utility;TextEditor;
X-GNOME-DocPath=gedit/gedit.xml
X-GNOME-FullName=Text Editor
X-GNOME-Bugzilla-Bugzilla=GNOME
X-GNOME-Bugzilla-Product=gedit
X-GNOME-Bugzilla-Component=general
X-GNOME-Bugzilla-Version=3.10.4
X-GNOME-Bugzilla-ExtraInfoScript=/usr/share/gedit/gedit-bugreport
Actions=Window;Document;
Keywords=Text;Editor;Plaintext;Write;
X-Ubuntu-Gettext-Domain=gedit

[Desktop Action Window]
Name=Open a New Window
Exec=gedit --new-window
OnlyShowIn=Unity;

[Desktop Action Document]
Name=Open a New Document
Exec=gedit --new-document
OnlyShowIn=Unity;

Now create a duplicate of this file as follow:

sudo cp /usr/share/applications/gedit.desktop /usr/share/applications/root_gedit.desktop

and make the following changes:

[Desktop Entry]
Name=gedit as root
GenericName=Text Editor as root
Comment=Edit text files
Exec=gksudo gedit %U
Terminal=false
Type=Application
StartupNotify=true
MimeType=text/plain;
Icon=accessories-text-editor
Categories=GNOME;GTK;Utility;TextEditor;
X-GNOME-DocPath=gedit/gedit.xml
X-GNOME-FullName=Text Editor
X-GNOME-Bugzilla-Bugzilla=GNOME
X-GNOME-Bugzilla-Product=gedit
X-GNOME-Bugzilla-Component=general
X-GNOME-Bugzilla-Version=3.10.4
X-GNOME-Bugzilla-ExtraInfoScript=/usr/share/gedit/gedit-bugreport
Actions=Window;Document;
Keywords=Text;Editor;Plaintext;Write;
X-Ubuntu-Gettext-Domain=gedit

[Desktop Action Window]
Name=Open a New Window
Exec=gksudo gedit --new-window
OnlyShowIn=Unity;

[Desktop Action Document]
Name=Open a New Document
Exec=gksudo gedit --new-document
OnlyShowIn=Unity;

After this, when you will search for gedit in the Dash you will see two instances of gedit: one named Text Editor and one Text Editor as root. You should open that one named Text Editor as root if you want to run gedit as root.

Note: gksudo must to be installed in order to use it. If you don't have installed, you can install it from terminal using:

sudo apt-get install gksudo