erikberglund / SwiftPrivilegedHelper

Example application using a privileged helper tool with authentication in an unsandboxed application written in Swift
MIT License
182 stars 34 forks source link

/bin/ls only #11

Open ghost opened 5 years ago

ghost commented 5 years ago

Hi @erikberglund

i moved to developed android and iOS app and then i'm back to Mac apps

now i test it again all is fine but issue is however i do anything but only /bin/ls command executes even tried /bin/rm or /bin/cp , also i found in code changed everywhere but still ls executes

i really don't have experience priviledgehelpers

hope you help me

Thanks

jeff-h commented 4 years ago

Since the /bin/ls command is defined in the helper in this example code, it sounds to me like you weren't successfully reinstalling your new helper whenever you changed its code. Don't forget that the helper tool is actually installed out of the App bundle into /Library/PrivilegedHelperTools/ and is actually run from the latter location.

For anyone with similar problems: it would be well worth checking /Library/PrivilegedHelperTools/ to confirm your helper binary there is the version and build timestamp you'd expect. If not, trace through your helper tool installation code.

@erikberglund we can probably close this issue.

barron9 commented 3 years ago

is that another option to change that in runtime?

chipjarred commented 3 years ago

@barron9 No, the helper tool is always installed in and run from /Library/PriviledgedHelperTools. That's just how SMJobBless works. Probably the most common reason for failure to install it there is forgetting to remove the App Sandbox capability for the main app's target in Xcode project settings. SMJobBless is the call that installs the helper tool, and so it has to have access to /Library/PriviledgedHelperTools which is not in the sandbox, so it will fail in a sandboxed app. A runtime option to change that behavior would be a security issue, so there isn't one.