简体   繁体   中英

How to set security and privacy settings of MAC from commandline

I am setting required password of security and privacy settings of MAC in command line by giving following command

/usr/libexec/PlistBuddy -c "set :askForPassword 1" "/Users/manuprasanna"/Library/Preferences/com.apple.screensaver.plist

With this com.apple.screensaver.plist is getting modified. But for this change to appear in UI, restarting of mac is required.

Is there any way to get this change to reflect in UI without restart.

In Mavericks, preferences are managed by a background daemon, cfprefsd. This service reads the preferences file once, when you first run the app. It then (I believe) receives notifications if you change the program's settings while the program is running, and then writes them to the actual preferences file at certain points in time. But cfprefsd always has a copy of those settings in its cache, and that's what the app gets when it checks its settings.

Following command will do the job without resatarting

killall cfprefsd

Reference : http://manytricks.com/blog/?p=3049

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM