Skip to content

Instantly share code, notes, and snippets.

@scriptingosx
Last active October 15, 2019 13:49
Show Gist options
  • Save scriptingosx/f1dc54c8e6cf382b6cdb4df022186c8d to your computer and use it in GitHub Desktop.
Save scriptingosx/f1dc54c8e6cf382b6cdb4df022186c8d to your computer and use it in GitHub Desktop.
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