Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a mac installer which runs as root with pre and post install bash scripts.

At the end of the post install script I launch the application which inherits and opens as root. Is there a way I can lower the permissions back down to the user that ran the installer and then open the app?

Or a more hackish way I can set the app to open in some scheduler from the script, which then gets opened by the scheduler which would have the users permissions

share|improve this question
    
No need to ask a new question, just edit this one. I'll remove my comments so as not to confuse people. –  Zoredache Sep 24 '12 at 16:58
    
Can you open the application using open, e.g. open -a /Applications/MyApp.app? If you're not installing an .app, you could check out output of env, it probably contains the actual user name. Just su -u $username /path/to/app or something like that. –  Daniel Beck Sep 24 '12 at 17:33
    
I'm currently opening the app with open "$APP_DIR". I guess a su -u "$username" "$APP_DIR"? –  GP89 Sep 24 '12 at 17:53
add comment

1 Answer 1

If you're logged in as root you can use su:

/bin/su -c "open -a App.app" username
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.