Instantly share code, notes, and snippets.

Embed
What would you like to do?
Sample script to modify authorization db on macOS
#!/bin/bash
# modify the system.preferences right
/usr/bin/security authorizationdb write system.preferences <<EndOfPlist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>allow-root</key>
<true/>
<key>authenticate-user</key>
<true/>
<key>class</key>
<string>user</string>
<key>comment</key>
<string>Checked by the Admin framework when making changes to certain System Preferences. Modified to allow techs access.</string>
<key>group</key>
<string>techs</string>
<key>session-owner</key>
<false/>
<key>shared</key>
<true/>
</dict>
</plist>
EndOfPlist
# modify the system.preferences.energysaver right
/usr/bin/security authorizationdb write system.preferences.energysaver <<EndOfPlist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>allow-root</key>
<true/>
<key>authenticate-user</key>
<true/>
<key>class</key>
<string>user</string>
<key>comment</key>
<string>Checked by the Admin framework when making changes to the Energy Saver preference pane. Modified to allow techs access.</string>
<key>group</key>
<string>techs</string>
<key>shared</key>
<true/>
</dict>
</plist>
EndOfPlist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment