Reputation: 22930
I want to launch cocoa application from root process in particular user.So i am changing owner and permission of my application.
If the s group of permissions has the user bit set (corresponding to u+s), then whenever anyone executes that program, the process takes on the privileges of whoever owns it.
sudo chown -R test myApp
sudo chmod u+s /Contents/MacOS/myApp
system([@"open myApp" UTF8String]); //inside root process
//-rwsr-xr-x 1 test myApp
Error:
com.apple.launchd[1]: System: Bug: launchd_core_logic.c:8760 (24498):0
com.apple.launchd[1]: System: job_mig_spawn() can't find its session!
open[24459]: spawn_via_launchd() failed, errno=5 label=[0x0-0x274274].
rootProcess[23127]: LSOpenURLsWithRole() failed with error -10810 for the file /Applications/myApp.app/.
can anyone please help me out?
Upvotes: 1
Views: 379
Reputation: 90571
You should read all of Technical Note TN2083: Daemons and Agents, but in particular, it says this:
A common question we get in [Apple Developer Technical Support] is "How can I launch a GUI application from my daemon?" The answer is that you can't.
Upvotes: 2