Ask Your Question

How to get the authenticate inputbox to enter root privileges in a compiled program ?

asked 2015-11-30 15:43:11 -0500

updated 2015-12-01 09:12:03 -0500

I had wanted to update GParted 0.23 to 0.24 in order to use the new features. Unfortunately, the koji's compilation failed one month ago so the new release is not available in the repo.

After the 0.24 local compilation, GParted works flawless except for launching, the program only displays a pop-up saying "Root privileges are required for running GParted". On behalf of this message, the 0.23 version asked my password in an input-box.

Do you know how to add authentication pop-up to a program? image

I would like to avoid running each time from the terminal : sudo /usr/local/sbin/gpartedbin

Thanks !

EDIT : Detailed solution from @leigh123linux's indications.

1/ Download the gparted rpm for Fedora 23 (even if we use Fedora 22)

2/ Extract manually these files from the archive :

  • /./usr/bin/gparted_polkit to /usr/bin/
  • /./usr/share/appdata/gparted.appdata.xml to /usr/share/appdata/
  • /./usr/share/polkit-1/actions/ to /usr/share/polkit-1/actions/

3/ Change the owners : sudo chown root:root <files above>

4/ Edit these files to change the path because the local compilation use /usr/local/sbin path by default :

  • sudo vi /usr/local/share/applications/gparted.desktop => /usr/bin/gparted_polkit %f
  • sudo vi /usr/bin/gparted_polkit => /usr/local/sbin/gparted (2 times)
  • sudo vi /usr/share/polkit-1/actions/ => /usr/local/sbin/gparted

If you are interested to know more about polkit, there is a good introduction here.

Thank again!

edit retag flag offensive close merge delete


I think you will need to fix the code, or wait for someone else to do that. There are usually reasons why newer versions are not already packaged.

randomuser gravatar imagerandomuser ( 2015-12-01 00:13:12 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2015-12-01 02:33:47 -0500

geforce gravatar image

Try looking here, you will need to add the polkit and pkexec files and edit the desktopfile.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2015-11-30 15:43:11 -0500

Seen: 197 times

Last updated: Dec 01 '15