0

How can I start and application with root privileges, just once.

For example I need to start SublimeText with sudo privileges, then I write in a console:

$ sudo subl

But, I wonder if there's any way to do this from the dash or side bar.

Something similar to 'Launch as administrator' from Windows.

Gocht
  • 385

2 Answers2

2

In my opinion, one way is to create executable shell script and then using pkexec run Sublime Text. I think that you can move the .sh file to dash then... But I am no longer using Ubuntu, so I am not so sure about this.

  1. Create empty file: touch run-sublime.sh

  2. Edit file using your favorite editor e.g. subl run-sublime.sh

  3. Paste this in file

    #!/bin/bash
    pkexec subl

  4. Make script excutable: chmod +x run-sublime.sh

2

You can create a .destop file with this:

Exec=pkexec subl

in the exec line and move this in the Dash.

and move that to the dash.

Bruni
  • 10,542
  • Better than my solution! :) Thanks for sharing! – honza-kasik Oct 23 '15 at 17:56
  • How is a full .desktop file? And there's any way to make this and option on the normal app launcher? – Gocht Oct 23 '15 at 17:57
  • You just have to put it in the right folder in your home where is the rest of .desktop files: https://help.ubuntu.com/community/UnityLaunchersAndDesktopFiles#Adding_a_.desktop_file_to_the_Unity_Launcher – honza-kasik Oct 23 '15 at 17:59