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.

4
  • You do not want to start sublime as root! – A.B. Oct 23 '15 at 17:48
  • @A.B. Sorry, do you mean that I shouldn't? It's an example, that could be nautilus or any other app. – Gocht Oct 23 '15 at 17:49
  • use gksudo instead of sudo – A.B. Oct 23 '15 at 17:53
  • @A.B. It's still a command line. – Gocht Oct 23 '15 at 17:54
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.

3
  • 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: help.ubuntu.com/community/… – honza-kasik Oct 23 '15 at 17:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.