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.
MacOS – Run script as root whenever any user logs in
launchdlogin-itemsmacosrootscript
Related Question
- MacOS – OSX Mavericks Root User
- MacOS – Run Script on Logout Without Use of Logout Hook
- MacOS – Running a script as root and presenting a GUI to logging in users
- How to run unix script in login screen before user logs in
- MacOS – Use script without root
- MacOS – Run script for delete HD
- MacOS – Automator: Run TextEdit as Root
- Run script on login *as root* on Catalina
Best Answer
Use a LoginHook.
See here for more detail.