3

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.

2
  • Modify the menu item to add GKsu? Commented Apr 2, 2014 at 18:16
  • 1
    What programs? How do you run them?
    – terdon
    Commented Apr 2, 2014 at 18:36

2 Answers 2

2

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
1
  • I've tried this but it still doesn't show up when searching in Dash
    – MrVimes
    Commented Sep 19, 2019 at 13:34
0

Some distributions (like Kali Linux for instance) automatically run everything as root, but those are usually intended to be ran as live systems because it's impossible to break a live system like you could on a hard install. All warnings aside, there is an interesting page all about root&ubuntu here, and another here that is intended for all Ubuntu variants.

You can do a few things, such as enable the root account and log in, which would run everything root automatically. That's not recommended. I think gksudo may be your best best,

sudo apt-get install gksudo

...but may I ask, why do you want to bypass the terminal? Can you tell me more about what exactly you're trying to do? I'd suggest that if you have need to run programs as root regularly, that you do it from a live usb/cd. This way, if anything goes wrong, you won't have to worry about breaking your system. If you need help making a live disc let me know.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .