[blfs-dev] gparted, polkit and sudo

David Brodie lfs at aba.eclipse.co.uk
Sat Dec 14 09:54:36 PST 2013


On 14/12/13 13:16, Fernando de Oliveira wrote:
> Have been following the discussion, at -support, where Armin solved a
> problem with gparted: essentially, care must be taken when using
> consolekit and polkit, to include support for Linux-PAM, if it is wanted
> to run gparted from a menu (WM or DE).
>
> Current instructions for gparted in the book seem incomplete and
> modifications seem necessary. It is well-known that there are several
> different approaches to get the job done. I introduced some comments in
> last update to gparted-0.17.0, in this way, but by then, already felt
> those had to be expanded.
>
> What is the best thing to do?

The simplest solution I've found for XFCE is to have a batch file, let's 
call it 'xsudo', in /usr/bin or wherever, containing the single line:

xterm -geom 60x5 -T "xsudo: $1" -e sudo -i $1

(Note, $1 is not quoted in the sudo -i command)

This can be run either from a terminal window or from a desktop launcher 
or from a menu, with the target program specified in the command line, 
for example:

xsudo gparted

xsudo "mousepad /etc/fstab"

(with quotes)

and it will display a small XTerm which will output the sudo password 
prompt, before running the command.

This also shouldn't require any changes to your sudoers configuration file.

(This is actually a cut-down version of "xdg-sudo" from xdg-utils, which 
was never formally released, it seems, but found its way into OpenSUSE - 
cut-down, and using sudo rather than su in the 'generic' option - 
OpenSUSE (12.1) actually goes the gksu route)

Regards,
David



More information about the blfs-dev mailing list