FS#26268 - [gksu] replace with pkexec in application launchers

Attached to Project: Community Packages
Opened by Balló György (City-busz) - Wednesday, 05 October 2011, 06:53 GMT
Last edited by Balló György (City-busz) - Wednesday, 06 March 2013, 02:35 GMT
Task Type Feature Request
Category Packages
Status Closed
Assigned To Jaroslav Lichtblau (Dragonlord)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 2
Private No

Details

The latest version of pkexec[1] supports running X11 apps, which makes possible to replace gksu in *.desktop files with it.

Reasons:
- gksu is an old, unmaintained package, which uses su and sudo, and not integrated well into modern desktop environments which uses PolicyKit for access control.
- pkexec[2] is part of the polkit package, and makes a standard way to run applications as a different user.
- polkit integrates well into DEs, KDE and GNOME has it's own authentication agent for polkit.
- The most of packages that currently uses gksu are already patched to use it, so changing to pkexec will not result more divergence from upstream.

Affected packages:
- nvclock
- wifi-radar

Steps for making this change:
1. Create a new policy file with the appropriate exec.path and unique name, and place it in /usr/share/polkit-1/actions folder.
2. Create a new small shell script that launches the application with pkexec.
3. Replace Exec=* with the newly created launcher in the *.desktop file.
4. Replace gksu optional dependency with polkit.
5. Fill an upstream feature request to use pkexec.

I attach a modified gparted package to demonstrate these changes.


[1] Upstream feature request in polkit: https://bugs.freedesktop.org/show_bug.cgi?id=38769
[2] More info about pkexec: http://hal.freedesktop.org/docs/polkit/pkexec.1.html
This task depends upon

Closed by  Balló György (City-busz)
Wednesday, 06 March 2013, 02:35 GMT
Reason for closing:  Implemented
Comment by Giovanni Scafora (giovanni) - Saturday, 08 October 2011, 07:32 GMT
gparted has been fixed.
Comment by Doug Newgard (Scimmia) - Thursday, 01 November 2012, 20:45 GMT
Doing this will not work in some cases, as the XAUTHORITY environmental variable may not be set for it. I a was having this issue running gparted while logging into XFCE or Enlightenment with KDM. External bug reports:

https://bugs.kde.org/show_bug.cgi?id=299718
https://bugs.launchpad.net/ubuntu/+source/policykit-1/+bug/997506

The solution they propose is to add a line to /etc/pam.d/polkit-1:

session optional pam_xauth.so

This did the job for me. I would suggest adding this line before switching any more packages to pkexec.
Comment by Jelle van der Waa (jelly) - Saturday, 08 December 2012, 12:00 GMT
Ettercap-gtk doesn't provide a .desktop anymore ;)
Comment by Balló György (City-busz) - Wednesday, 06 March 2013, 02:34 GMT
- nvclock is no longer in official repos
- wifi-radar is fixed now

@Doug: if it's still a problem, please report it to the appropriate project (KDM).

Loading...