When I try to load some process behalf of another user I receive next error:
sudo: someusername: command not found
system result: 256
Please note that I run it from the process which is running under root.
Here is a code how I do:
NSString *command = @"sudo someusername /bin/launchctl load -S Aqua /Library/LaunchAgents/com.agent.someagent.plist";
int result = system([command UTF8String]);
NSLog(@"system result: %d", result);