Tuesday, May 7, 2024
 Popular · Latest · Hot · Upcoming
100
rated 0 times [  100] [ 0]  / answers: 1 / hits: 266269  / 2 Years ago, sun, january 2, 2022, 4:52:36

Mainly I am looking for a way to pin an application to the Unity launch bar, and run it as root.



Currently, even if I start the application with sudo, and pin it after it starts, it will start as current user next time.



Sad, but there is no context menu option "run as ...".



Update: I switched to gnome3 and now I'm happy, I'm missing only the search.


More From » unity

 Answers
7

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:




    • /usr/share/applications/APPNAME.desktop

    • ~/.local/share/applications/APPNAME.desktop

    • 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

[Runroot Shortcut Group]
Name=Run as root
Exec=gksudo -k -u root APP_COMMAND
TargetEnvironment=Unity

[#39482] Sunday, January 2, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
splenueak

Total Points: 448
Total Questions: 118
Total Answers: 110

Location: Vanuatu
Member since Mon, Oct 3, 2022
2 Years ago
;