Friday, May 28, 2010

Enable Screen Saver Locking From the Command Line: Snow Leopard

The settings are now stored in ~/Library/Preferences/com.apple.screensaver.plist:

$ defaults read com.apple.screensaver
{
    askForPassword = 1;
    askForPasswordDelay = 5;
}
$

To turn on the screen saver lock:

defaults write com.apple.screensaver askForPassword -int 1


To turn off the screen saver lock:

defaults write com.apple.screensaver askForPassword -int 0 

Thursday, May 27, 2010

Turn on Mac screen saver password from command line (not for Snow Leopard)

Turn on the screen saver password:

defaults -currentHost write com.apple.screensaver askForPassword -int 1

Turn off Screen saver password:

defaults -currentHost write com.apple.screensaver askForPassword -int 0

Again, this doesn't work for Snow Leopard.