App Needs Root Privilege to Open in Menu (SOLVED)

Questions about applications and software
Forum rules
Before you post please read how to get help
Post Reply
ACFireTypeMaster
Level 1
Level 1
Posts: 35
Joined: Mon Nov 13, 2017 1:49 am
Location: Wyoming

App Needs Root Privilege to Open in Menu (SOLVED)

Post by ACFireTypeMaster » Wed Oct 24, 2018 6:41 pm

I am running Linux Mint 19 "Tara" and am trying to make a Micron Storage Executive to run through the menu. The app requires root privileges to start-up, I had to create a launcher in the Mint Menu, which links to the .run file. The file works, but only with root privileges, what command can I add to the menu editor for this app to ask for the root access similar to Timeshift, System Reports, etc.?
Last edited by ACFireTypeMaster on Thu Jan 03, 2019 9:48 pm, edited 1 time in total.

gm10
Level 19
Level 19
Posts: 9738
Joined: Thu Jun 21, 2018 5:11 pm

Re: App Needs Root Privilege to Open in Menu

Post by gm10 » Thu Oct 25, 2018 1:47 am

Run this in a terminal window:

Code: Select all

mkdir -p ~/.local/bin;echo -e '#!/bin/sh'"\n"'/usr/bin/pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY HOME=$HOME "$@"' > ~/.local/bin/gksudo;chmod u+x ~/.local/bin/gksudo
Then prefix your command for the menu entry with:

Code: Select all

gksudo
The prefix will work for any other app you want to run elevated from the menu, too.
Last edited by gm10 on Wed Oct 31, 2018 11:47 am, edited 2 times in total.

ACFireTypeMaster
Level 1
Level 1
Posts: 35
Joined: Mon Nov 13, 2017 1:49 am
Location: Wyoming

Re: App Needs Root Privilege to Open in Menu

Post by ACFireTypeMaster » Wed Oct 31, 2018 10:41 am

Sorry for the late reply, I got caught-up, I ran it and now it will not accept gksudo as a command in the menu editor. Before it allowed it, it just would not do it.

gm10
Level 19
Level 19
Posts: 9738
Joined: Thu Jun 21, 2018 5:11 pm

Re: App Needs Root Privilege to Open in Menu

Post by gm10 » Wed Oct 31, 2018 11:16 am

ACFireTypeMaster wrote:
Wed Oct 31, 2018 10:41 am
Sorry for the late reply, I got caught-up, I ran it and now it will not accept gksudo as a command in the menu editor. Before it allowed it, it just would not do it.
I take it you are using Cinnamon? That's a bug with their menu editor.

Run this then the menu editor will work:

Code: Select all

sudo mv ~/.local/bin/gksudo /usr/local/bin/;sudo chmod +x /usr/local/bin/gksudo

ACFireTypeMaster
Level 1
Level 1
Posts: 35
Joined: Mon Nov 13, 2017 1:49 am
Location: Wyoming

Re: App Needs Root Privilege to Open in Menu

Post by ACFireTypeMaster » Wed Oct 31, 2018 11:21 am

Yes, It worked, thank you! That is kinda of a strange bug, I imagine it is not very commonly encountered however. Extra thank you wizard of linux mint.

gm10
Level 19
Level 19
Posts: 9738
Joined: Thu Jun 21, 2018 5:11 pm

Re: App Needs Root Privilege to Open in Menu

Post by gm10 » Wed Oct 31, 2018 11:28 am

ACFireTypeMaster wrote:
Wed Oct 31, 2018 11:21 am
Yes, It worked, thank you! That is kinda of a strange bug, I imagine it is not very commonly encountered however. Extra thank you wizard of linux mint.
edit: it wasn't actually a bug but rather me not being aware of how Mint's default ~/.profile is set up in combination with how Cinnamon's launcher editor works.
Last edited by gm10 on Thu Nov 01, 2018 1:47 pm, edited 2 times in total.

gm10
Level 19
Level 19
Posts: 9738
Joined: Thu Jun 21, 2018 5:11 pm

Re: App Needs Root Privilege to Open in Menu

Post by gm10 » Wed Oct 31, 2018 11:49 am

ACFireTypeMaster wrote:
Wed Oct 31, 2018 11:21 am
Actually there was something wrong with my script, thanks to karlchen for pointing a typo out to me. It will work regardless but just for style points could you run this please to correct it:

Code: Select all

echo -e '#!/bin/sh'"\n"'/usr/bin/pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY HOME=$HOME "$@"'|sudo tee /usr/local/bin/gksudo
;)

ACFireTypeMaster
Level 1
Level 1
Posts: 35
Joined: Mon Nov 13, 2017 1:49 am
Location: Wyoming

Re: App Needs Root Privilege to Open in Menu

Post by ACFireTypeMaster » Wed Oct 31, 2018 12:52 pm

I ran it and it seems to have done whatever it is it did with an output of weirdness that makes sense to certain people. It all still works too so that is good. Once more I thank you sorcerer.

Post Reply

Return to “Software & Applications”