Monday, April 29, 2024
 Popular · Latest · Hot · Upcoming
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 12084  / 3 Years ago, sat, may 15, 2021, 3:05:57

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.


More From » root

 Answers
5

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

[#26230] Saturday, May 15, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
measord

Total Points: 259
Total Questions: 131
Total Answers: 106

Location: Venezuela
Member since Sun, Oct 2, 2022
2 Years ago
;