[blfs-dev] gparted, polkit and sudo

Fernando de Oliveira famobr at yahoo.com.br
Sun Dec 15 11:54:55 PST 2013

Em 14-12-2013 14:54, David Brodie escreveu:
> 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

Thank you for your post, David, helping me again.

I have modified some text when I committed the instructions to use
'ssh-askpass' and 'pkexec', at r12399, after what you wrote. However, I
did not want to use xterm. Please, remember that in my original post, I
wrote (full of misplaced words):

> Another [solution] for pkexec to work is to change the .desktop installed by
> gparted, if I change:
> s/Terminal=false/Terminal=true/
> But then, first, a x-terminal appears and then the x-dialog is launched.

It took longer for me to get the other pkexec solution exactly because I
dislike when I need xterm to get something. Another time I used it was a
bit similar to what you propose, when I wanted to get
shutdown/reboot/logout from a menu, and created a script that used
xterm. Later, I learned a little more, and replaced by a x-dialog script
as was used by gparted-live, pmagic and systemrescuecd (IIRC).

Thank you again for your post, and hope you do not mind that I did not
include your solution in the commit.


More information about the blfs-dev mailing list