How to launch application as root from Unity Launcher?

English

If you want the app to always run as root

1) Pin the application to the launcher as normal.

2) Locate the applications .desktop file which will be in either:

  1. /usr/share/applications/APPNAME.desktop
  2. ~/.local/share/applications/APPNAME.desktop
  3. or somewhere else, use locate .desktop|grep APPAME

3) Open with gedit:

gksudo gedit /usr/share/applications/APPNAME.desktop
4) Then change the line

Exec=APP_COMMAND
to

Exec=gksudo -k -u root APP_COMMAND
5) Save

This command will also keep your environment which is very usefull if you need to connect to others servers and use your private key.

To add a quicklist option to 'Run as root'

Follow steps 1, 2 and 3 above

If the launcher currently doesn't have any other quicklist options, just append this to the end of the document

X-Ayatana-Desktop-Shortcuts=Runroot

  1. [Runroot Shortcut Group]
  2. Name=Run as root
  3. Exec=gksudo -k -u root APP_COMMAND
  4. TargetEnvironment=Unity
Категория: 
The code has been tested and works

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.
Target Image