Recent

Author Topic: Execute with privileges, SUDO, SMJobBless ...?  (Read 3677 times)

Hansaplast

  • Hero Member
  • *****
  • Posts: 612
  • Tweaking4All.com
    • Tweaking4All
Execute with privileges, SUDO, SMJobBless ...?
« on: January 06, 2015, 02:24:44 pm »
I'm looking for insight and/or help to execute a thread or shell task with elevated rights.

In my program, I execute "dd" to read or write disk images. For this elevated admin rights (root?) are needed.

In the past using "AuthorizationExecuteWithPrivileges" worked great, however there are two major problems with this "trick";

  • The function has been depreciated since Mac OS X 10.7 (still functional, but with Apple's track record it can disappear any day).
  • When using "dd" and passing data to or from (for example) zip, this function no longer works.
The alternative, executing a "sudo" statement, either passing the password in the shell statement (not secure) or passing the password through stdin (as described in one or the other Wiki page). However, I've had several users reports, saying that this does not work on there computer (yet the AuthorizationExecuteWithPriviliges does work with all users - so far).

Searching the web, I've found the some information by Apple, but the lack of Objective-C experience and the semi chaotic way they do this (in my head anyway), makes it hard for me to comprehend and convert to Lazarus Pascal. I wouldn't even know where to start with the chaotic way this is described (see: Apple SMJobBless).


Has anyone worked with something like this before? Possible even converted one or the other Apple example?

Hansaplast

  • Hero Member
  • *****
  • Posts: 612
  • Tweaking4All.com
    • Tweaking4All
Re: Execute with privileges, SUDO, SMJobBless ...?
« Reply #1 on: January 06, 2015, 02:28:02 pm »
FYI: This is the Wiki I referred to "Executing External Programs", which works great on my own computer, but causes issue with app 10% of the users of my little application.


Also note that it seems that neither method will work when an app is distributed through the Apple App Store (Sandboxing).

 

TinyPortal © 2005-2018