You are not logged in.

#1 2013-06-17 07:00:27

totolotto
Member
From: Hungary
Registered: 2012-11-13
Posts: 114

Dmenu apps with sudo

Certain applications require root privileges to run (gparted etc.).

Is there a way to run these from dmenu? How can I get an automatic popup window or terminal to enter the root password? I installed gksu but it just shows the warning message and does not offer password enter. Thanks.

Offline

#2 2013-06-17 07:17:07

ntness
Member
From: The World
Registered: 2009-12-29
Posts: 97

Re: Dmenu apps with sudo

The method I employ is to write a small script that runs said program with sudo and your terminal of choice.

General format:

#!/bin/bash

your_terminal_emulator -e sudo program_requiring_sudo

Personal example:

#!/bin/bash

urxvt -e sudo solfege

Once the file is created, don't forget to chmod +x, and then you can copy/move it to /usr/local/bin (though I'm not certain this is the best directory for dropping these files). Finally, try running from dmenu smile


transcend to the fifth abode

Offline

#3 2013-06-17 08:55:03

skanky
Member
From: WAIS
Registered: 2009-10-23
Posts: 1,847

Re: Dmenu apps with sudo

Look up the -A option of sudo and askpass.


"...one cannot be angry when one looks at a penguin."  - John Ruskin
"Life in general is a bit shit, and so too is the internet. And that's all there is." - scepticisle

Offline

#4 2013-06-17 10:46:58

totolotto
Member
From: Hungary
Registered: 2012-11-13
Posts: 114

Re: Dmenu apps with sudo

For ASKPASS option you need to execute sudo with -A option, which is not good for Dmenu - is it? ntness' post is also a workaround solution.

I have seen in DEs that an "authentication" window pops up so you can enter the password there - how does it work? Google did not help me in this.

Offline

#5 2013-06-17 11:04:55

skanky
Member
From: WAIS
Registered: 2009-10-23
Posts: 1,847

Re: Dmenu apps with sudo

Why is -A not good for dmenu?
I use a script that calls dmenu (or slmenu), gets the response and then calls

sudo -A $RESPONSE

If the application is run in a terminal, you don't need a pop-up and can enter the password at the command prompt of that terminal.
If the application is gui, you can do the above. If the script is background (eg I have one to unmount removable drives that has no ui) then again, you can use the above method.

Unless I'm missing something?


"...one cannot be angry when one looks at a penguin."  - John Ruskin
"Life in general is a bit shit, and so too is the internet. And that's all there is." - scepticisle

Offline

#6 2013-06-18 16:04:33

ball
Member
From: Germany
Registered: 2011-12-23
Posts: 164

Re: Dmenu apps with sudo

https://bbs.archlinux.org/viewtopic.php … 37#p777137 provides an example how to use "sudo -A" together with dmenu.

Offline

Board footer

Powered by FluxBB