In many cases the answer is the user that is currently logged in. Then the problem is as which user you want to run as. To get the correct behavior, you need to run the command as a user. This is probably not what you intended to do. Then it will write this preference into root’s home directory in /var/root/Library/Preferences/. When your script, executed by your management system, is running as root and contains this command: defaults write orientation left However, some commands need to be run not as root, but as the user.įor example, the defaults command can be used to read or set a specific setting for a user.
The pre– and postinstall scripts in installation packages (pkgs), the agent for your management system, and scripts executed as LaunchDaemons all run with root privileges. The good news here that many of the management tools we can use to run scripts on clients already run with root privileges. Rather than keep modifying the older post, I decided to make this new one.Īs MacAdmins, most of the scripts we write will use tools that require administrator or super user/root privileges. macOS has changed and I had a few things to add.
This post is an update to an older post on the same topic.