After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 699626 - Enable gparted.desktop to prompt for root on default openSUSE installation
Enable gparted.desktop to prompt for root on default openSUSE installation
Status: RESOLVED FIXED
Product: gparted
Classification: Other
Component: application
0.16.1
Other Linux
: Normal normal
: ---
Assigned To: gparted maintainers alias
gparted maintainers alias
Depends on:
Blocks:
 
 
Reported: 2013-05-03 19:50 UTC by Curtis Gedak
Modified: 2013-09-18 16:45 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to add xdg-su program to gparted.desktop file (1.15 KB, patch)
2013-05-03 20:14 UTC, Curtis Gedak
none Details | Review

Description Curtis Gedak 2013-05-03 19:50:31 UTC
The default installation of openSUSE does not include gksudo, gksu, or kdesudo.  As such when the gparted code is compiled and installed, the resulting gparted.desktop file fails to prompt for root access.

This problem can be resolved by adding "xdg-su -c" to the gparted.desktop file.  The command xdg-su is included in the default installation of openSUSE.

A patch will be coming shortly.
Comment 1 Curtis Gedak 2013-05-03 20:14:52 UTC
Created attachment 243245 [details] [review]
Patch to add xdg-su program to gparted.desktop file

This patch has been successfully tested on the following GNU/Linux distributions:

   openSUSE 11.2, 12.2
   Debian    6
   Ubuntu   13.04
   Kubuntu  12.04

If none of gksudo, gksu, kdesudo, or xdg-su is available, then gparted.desktop will not prompt for root privilege.  This is the case with Fedora 18 which does not appear to include any of these graphical switch-to-root programs by default.
Comment 2 Mike Fleetwood 2013-05-04 15:26:26 UTC
(In reply to comment #1)
> If none of gksudo, gksu, kdesudo, or xdg-su is available, then
> gparted.desktop will not prompt for root privilege.  This is the case
> with Fedora 18 which does not appear to include any of these graphical
> switch-to-root programs by default.

Hi Curtis,

I think that it's if none of gksudo, gksu, kdesudo or xdg-su are
available then gparted.desktop will run gparted without prompting for
root privileges and therefore display error this dialog and exit
afterwards.

    (X) Root privileges are required for running GParted
        Since GParted is a powerful tool capable or destroying partition
        tables and vast amounts of data, only root may run it.
                                                                [  OK  ]
However on Fedora, RHEL and CentOS the distribution built RPM packages
of GParted use consolehelper (http://linux.die.net/man/8/consolehelper)
which prompts for the root password before running GParted.

 $ grep Exec= /usr/share/applications/fedora-gparted.desktop 
 Exec=/usr/bin/gparted %f

 $ ls -l /usr/bin/gparted
 lrwxrwxrwx. 1 root root 13 Mar  9  2011 /usr/bin/gparted -> consolehelper

 cat /etc/pam.d/gparted 
 #%PAM-1.0
 auth    sufficient      pam_rootok.so
 auth    sufficient      pam_timestamp.so
 auth    include         system-auth
 session required        pam_permit.so
 session optional        pam_xauth.so
 session optional        pam_timestamp.so
 account required        pam_permit.so


Anyway I've tested your patch on CentOS 5.9 with and without xdg-su and
it works fine.  Going out soon so it'll be tomorrow before I commit
this.

Thanks,
Mike
Comment 3 Mike Fleetwood 2013-05-04 15:41:17 UTC
Completing the picture ...

 $ cat /etc/security/console.apps/gparted 
 USER=root
 PROGRAM=/usr/sbin/gparted
 SESSION=true

gparted.desktop -> /usr/bin/gparted -> consolehelper ->
userhelper
+ /etc/pam.d/gparted
+ /etc/security/console.apps/gparted ->
/usr/sbin/gparted (as root)
Comment 4 Curtis Gedak 2013-05-04 15:50:29 UTC
Thank you Mike for the details on how Fedora / RHEL / CentOS handle root privilege in their gparted packages.

There does not appear to be a single standard that all GNU/Linux distributions use.  Currently the *buntu series uses polkit which is quite different from console keeper, as shown below:

$ cat /usr/share/applications/gparted.desktop 
[Desktop Entry]
Name=GParted
GenericName=Partition Editor
X-GNOME-FullName=GParted Partition Editor
Comment=Create, reorganize, and delete partitions
Exec=gparted-pkexec
Icon=gparted
Terminal=false
Type=Application
Categories=GNOME;System;Filesystem;Settings;
StartupNotify=true
X-Ubuntu-Gettext-Domain=gparted


$ cat /usr/bin/gparted-pkexec 
#!/bin/sh
pkexec "/usr/sbin/gparted" "$@"


$ cat /usr/share/polkit-1/actions/com.ubuntu.pkexec.gparted.policy
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE policyconfig PUBLIC
 "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
 "http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
<policyconfig>

  <action id="com.ubuntu.pkexec.gparted">
    <message gettext-domain="gparted">Authentication is required to run the GParted Partition Editor</message>
    <icon_name>gparted</icon_name>
    <defaults>
      <allow_any>auth_admin</allow_any>
      <allow_inactive>auth_admin</allow_inactive>
      <allow_active>auth_admin</allow_active>
    </defaults>
    <annotate key="org.freedesktop.policykit.exec.path">/usr/sbin/gparted</annotate>
    <annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
  </action>

</policyconfig>


My thoughts are that it might be best to leave these more complicated methods of acquiring root privilege to the individual distro packagers.
Comment 5 Mike Fleetwood 2013-05-05 10:55:38 UTC
Hi Curtis,

I've added this patch to the upstream repository for inclusion in the
next release of GParted.

Add xdg-su program to gparted.desktop file
https://git.gnome.org/browse/gparted/commit/?id=e5a426d0b389022f2bdff9be0bdec173d02030f0

Thanks,
Mike
Comment 6 Curtis Gedak 2013-05-05 18:41:57 UTC
Hi Mike,

I forgot to update the README file to add xdg-su to the list of programs used to acquire root privileges in the gparted.desktop file.

As such I have added the following update for inclusion in the next release of GParted.

Add xdg-su to README (#699626)
https://git.gnome.org/browse/gparted/commit/?id=00960e0172ae44a907a93ca77f7ef14b1e593772
Comment 7 Curtis Gedak 2013-09-18 16:45:28 UTC
The patch to address this report has been included in GParted 0.16.2 released on September 18, 2013.