Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .