1

What's the best way to run a script with root privileges whenever any user logs in? It should run in the background without prompting the user for a password.

  • Logs in through the Finder GUI or opens a terminal prompt? – beroe Sep 2 '14 at 19:20
  • Through the GUI – user3417268 Sep 3 '14 at 20:01
2

Use a LoginHook.

sudo defaults write com.apple.loginwindow LoginHook /path/to/script

See here for more detail.

1

I still haven't found a way to do exactly this, but since the script I need to run is just a chmod command, it's sufficient to run it via a launchdaemon every 10 seconds instead.

You must log in to answer this question.

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