0

On Mac OSX, the third-party command line tool I have needs to run as super user unfortunately. I'm building a front-end GUI for it. My Qt/C++ application is using QProcess to shell out to Bash and run this command via echo "{PASS}" sudo -l "{USER}" -S {COMMAND}. I'm successful with that -- just as long as I have the Apple ID user/pass.

Is there a way my PKG installer can graphically prompt for Apple ID user/pass? Second, how would you recommend I store this securely?

  • You could possibly add a postinstall/preinstall action asking for the username and password. – At0mic Sep 20 '15 at 3:24
  • I can use echo "{PASSWORD}" | sudo -l "{USERNAME}" -S {COMMAND}, but the problem is how to graphically prompt for that during the setup wizard of the PKG installation process? – Volomike Sep 20 '15 at 3:27
  • you may be able to add a script which executes an app to get the user's password: (here's a helpful link on pkg scripts) – At0mic Sep 20 '15 at 3:33
  • @IronCraftMan I may have found the answer. Can you confirm? When I read some documentation about Apple's PackageManager tool, when I scroll down in that, I think it says that if I choose the Admin Authorization flag on the installer, then all Bash scripts that run from that will run as root and will not require sudo authorization. – Volomike Sep 20 '15 at 3:35
  • the should run as root, as all installer pkgs require an admin authorization. – At0mic Sep 20 '15 at 3:38
1

From this documentation...

http://s.sudre.free.fr/Software/documentation/Packages/en/Package_Settings_Customization.html#6

...it states that Apple PackageManager files (.PKG) files have an option to run with Administrator privileges. It specifically states:

If you install anything in /Applications or /Library, this option should be enabled.

Also, in this documentation...

http://s.sudre.free.fr/Stuff/PackageMaker_Howto.html

...it states that Bash scripts that you run will run under Administrator privileges (root) and therefore will not require sudo authentication to do powerful tasks.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .