OSX: 實用指令碼程式(bash scripts)系列-23-編輯認證資料庫

來源:互聯網
上載者:User

詳細解釋見上一篇:OSX: 管理認證資料庫(Authorization Database)

這裡主要是貼出可以使用的系統偏好配置的一個真執行個體子:

#!/bin/bash## Set the system Authorization Database rights## allow everyone access to system preferences itself security authorizationdb read system.preferences > /tmp/system.preferences.plist /usr/libexec/PlistBuddy -c "set group powerusers" /tmp/system.preferences.plist sudo security authorizationdb write system.preferences < /tmp/system.preferences.plist # Then, for the system.restart options.security authorizationdb read system.restart > /tmp/system.restart.plist /usr/libexec/PlistBuddy -c "set class user" /tmp/system.restart.plist /usr/libexec/PlistBuddy -c "add allow-root bool YES" /tmp/system.restart.plist /usr/libexec/PlistBuddy -c "add group string everyone" /tmp/system.restart.plist /usr/libexec/PlistBuddy -c "set shared bool NO" /tmp/system.restart.plist /usr/libexec/PlistBuddy -c "delete mechanisms array" /tmp/system.restart.plist sudo security authorizationdb write system.restart < /tmp/system.restart.plist # For system.shutdown.security authorizationdb read system.shutdown > /tmp/system.shutdown.plist /usr/libexec/PlistBuddy -c "set class user" /tmp/system.shutdown.plist /usr/libexec/PlistBuddy -c "add allow-root bool YES" /tmp/system.shutdown.plist /usr/libexec/PlistBuddy -c "add group string everyone" /tmp/system.shutdown.plist /usr/libexec/PlistBuddy -c "set shared bool NO" /tmp/system.shutdown.plist /usr/libexec/PlistBuddy -c "delete mechanisms array" /tmp/system.shutdown.plist sudo security authorizationdb write system.shutdown < /tmp/system.shutdown.plist # For adjusting the Time Zone.##timezone, need to add on 10.5 and later, everyone /usr/libexec/PlistBuddy -c "add class string allow" /tmp/system.preferences.dateandtime.changetimezone.plist /usr/libexec/PlistBuddy -c "add comment string Timezones" /tmp/system.preferences.dateandtime.changetimezone.plist /usr/libexec/PlistBuddy -c "add shared bool YES" /tmp/system.preferences.dateandtime.changetimezone.plist sudo security authorizationdb write system.preferences.dateandtime.changetimezone < /tmp/system.preferences.dateandtime.changetimezone.plist # For print.operator.## print operator, everyone security authorizationdb read system.print.operator > /tmp/print.operator.plist /usr/libexec/PlistBuddy -c "set group everyone" /tmp/print.operator.plist sudo security authorizationdb write system.print.operator < /tmp/print.operator.plist # For system.preferences.printing.## printer prefpane, powerusers.  requires additional right security authorizationdb read system.preferences.printing > /tmp/system.preferences.printing.plist /usr/libexec/PlistBuddy -c "set group powerusers" /tmp/system.preferences.printing.plist sudo security authorizationdb write system.preferences.printing < /tmp/system.preferences.printing.plist ## add group 'powerusers' to 'lpadmin' group sudo dseditgroup -o edit -a powerusers -t group lpadmin #For system.preferences.softwareupdate.## software update, everyone, requires additional right security authorizationdb read system.preferences.softwareupdate > /tmp/system.preferences.softwareupdate.plist /usr/libexec/PlistBuddy -c "set group everyone" /tmp/system.preferences.softwareupdate.plist sudo security authorizationdb write system.preferences.softwareupdate < /tmp/system.preferences.softwareupdate.plist security authorizationdb read system.install.apple-software > /tmp/system.install.apple-software.plist /usr/libexec/PlistBuddy -c "set rule:0 allow" /tmp/system.install.apple-software.plist sudo security authorization write system.install.apple-software < /tmp/system.install.apple-software.plist security authorizationdb read com.apple.SoftwareUpdate.scan > /tmp/com.apple.SoftwareUpdate.scan.plist /usr/libexec/PlistBuddy -c "set rule:0 allow" /tmp/com.apple.SoftwareUpdate.scan.plist sudo security authorizationdb write com.apple.SoftwareUpdate.scan < /tmp/com.apple.SoftwareUpdate.scan.plist # For system.preferences.network.## network preferences, powerusers, requires additional right security authorizationdb read system.preferences.network > /tmp/system.preferences.network.plist /usr/libexec/PlistBuddy -c "set group powerusers" /tmp/system.preferences.network.plist sudo security authorizationdb write system.preferences.network < /tmp/system.preferences.network.plist security authorizationdb read system.services.systemconfiguration.network > /tmp/system.services.systemconfiguration.network.plist /usr/libexec/PlistBuddy -c "set group powerusers" /tmp/system.services.systemconfiguration.network.plist sudo security authorizationdb write system.services.systemconfiguration.network < /tmp/system.services.systemconfiguration.network.plist # For system.preferences.energysaversecurity authorizationdb read system.preferences.energysaver > /tmp/system.preferences.energysaver.plist /usr/libexec/PlistBuddy -c "set group powerusers" /tmp/system.preferences.energysaver.plist sudo security authorizationdb write system.preferences.energysaver < /tmp/system.preferences.energysaver.plist # For system.preferences.timemachine.## time machine, powerusers security authorizationdb read system.preferences.timemachine > /tmp/system.preferences.timemachine.plist /usr/libexec/PlistBuddy -c "set group powerusers" /tmp/system.preferences.timemachine.plist sudo security authorizationdb write system.preferences.timemachine < /tmp/system.preferences.timemachine.plist 


聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.