Mac OS X: 實用腳本程序(bash scripts)系列-10
--Preferences的幾個例子
舉幾個通過變更Plist文件改變系統行為的例子:
1.1 電腦管理員可以設置需要Admin來控制Airport的功能,在Mac OS X 10.5 Leopard中首次提供。在GUI環境中很容易做到,見下圖:
對應的shell:
plistbuddy -c "Add $currentSet:Network:Interface:en1:AirPort:RequireAdmin bool yes" /Library/Preferences/SystemConfiguration/preferences.plist
1.2 Snow Leopard中的設置:
對應的shell:
plistbuddy -c "Add $currentSet:Network:Interface:en1:AirPort:RequireAdminPowerToggle bool yes" /Library/Preferences/SystemConfiguration/preferences.plist
2. 禁止用戶打開Finder的Preferences的shell:
defaults write com.apple.finder ProhibitFinderPreferences -bool YES
3. 禁止Finder在Sidebar中顯示Shared的機器列表:
plistbuddy -c "set :networkbrowser:CustomListProperties:com.apple.NetworkBrowser.backToMyMacEnabled no"
plistbuddy -c "set :networkbrowser:CustomListProperties:com.apple.NetworkBrowser.bonjourEnabled no"
plistbuddy -c "set :networkbrowser:CustomListProperties:com.apple.NetworkBrowser.connectedEnabled no"
4. 禁止自動更新
4. 1 禁止Mac OS X系統自動更新:
softwareupdate --schedule off
4.2 禁止MS Office 2004自動更新:
defaults write com.microsoft.autoupdate HowToCheck -string "Manual"
4.3 禁止MS Office 2008自動更新:
defaults write com.microsoft.autoupdate2 HowToCheck -string "Manual"
4.4 禁止Adobe CS3自動更新
sed -i "" 's:<AutoCheck>1</AutoCheck>:<AutoCheck>0</AutoCheck>:' /
/Users/$USER/Library/Application/ Support/Adobe/Updater5/AdobeUpdaterPrefs.dat
4.5 禁止Adobe CS4自動更新
sed -i "" 's:<AutoCheck>1</AutoCheck>:<AutoCheck>0</AutoCheck>:' /
/Users/$USER/Library/Application/ Support/Adobe/Updater6/AdobeUpdaterPrefs.dat
5.迫使Safari 4在tab中打開新網頁
defaults write com.apple.Safari TargetedClicksCreateTabs -bool true
更多文章、技術交流、商務合作、聯系博主
微信掃碼或搜索:z360901061

微信掃一掃加我為好友
QQ號聯系: 360901061
您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。
【本文對您有幫助就好】元
