I've got an application (A daemon inside /Library/StartupItems to be precise) running as root that occasionally launches another process using system("open /Applications/MyAppName.app")
. This works fine except that on certain computers MyAppName gets launched running as root, instead of under the current user.
I'm trying to figure out why this is, and how I can get the application to always launch as the current user.
The issue seems to occur at enterprise sites running some combination of Open/Active directory. I have somewhat limited access to these machines so I'm trying to at least form some hypotheses before I request more time on them.
The one other clue I have is that on at least one of these computers if you open up Activity Monitor and inspect the "Finder" process, the "User:" section shows user name but no user id (the "(UID)" section is entirely missing).
Also, the Parent Process shows as "launchd (1)
" rather than "launchd (95)
" like most standard applications do. This instance of launchd I believe is the run that's the first thing to start up any time the computer is booted up and runs as root, as compared to the other instance of launchd which runs as the logged in user.
Besides the obvious security concerns, I need the application to not run as root so that it will support things such as being open for/visible to two simultaneously logged in users.
Does anybody have any ideas about what might be causing this or how I might go about solving it?