Posted on 11-07-2014 11:39 AM
In my Yos FB script, I want to change how long after the screen saver starts that it prompts for a password to unlock the machine. The request is to have it immediate, but I can't seem to find the command to do so, 5 seconds seems to be the best I can find.
defaults write /System/Library/User Template/English.lproj/Library/Preferences/ByHost/com.apple.screensaver.$MAC_UUID "askForPasswordDelay" -int 1
Posted on 11-07-2014 11:58 AM
Any reason you're putting that into the ByHost preference? I don't think it goes there. Try plugging it into the regular com.apple.screensaver.plist file.
Also, you want -int 0 for Immediately. Since that setting can now only take pre-defined values, if you try to enter something like "1" it bumps it to the next available value, which is "5"
Lastly, why not manage this with a Config Profile or even MCX?
Posted on 11-07-2014 12:01 PM
I don't have a Yosemite machine right here, but Mavericks shows this for "Immediate":
<dict>
<key>askForPassword</key>
<integer>1</integer>
<key>askForPasswordDelay</key>
<real>0.0</real>
<key>tokenRemovalAction</key>
<integer>0</integer>
</dict>
"0.0" and "real" may be important? I need to get a Yosemite machine built at work so I can test this kind of thing. We just took the labs to Mavericks this semester.
Posted on 11-07-2014 12:16 PM
This got all messed up on Yosemite for us. It was "immediate" in 10.7-10.9 but changed to 5 seconds when we went to Yosemite, so I had to create a new configuration profile to add to the existing one.
I used Passcode, maxGracePeriod, integer 0 (stock Profile Manager setting that works for both iOS and OS X).
<string>Passcode</string><key>maxGracePeriod</key><integer>0</integer>
Posted on 11-07-2014 12:44 PM
Just took a look on a Yosemite system and that value now shows up as type "float" (floating point) whereas at one time it was clearly "integer" so yes, it did change.
So maybe something like:
defaults write com.apple.screensaver askForPasswordDelay -float 0.0
Similar to what @bcarter5876 found
Kind of bizarre that they are using float now, As far as I can tell, it can't really accept decimal values. For example, you can't set the screensaver ask for password delay to something like 10.5 seconds. Can't understand why they didn't just keep it as integer.
Posted on 11-09-2014 08:09 PM
The preference file that is written to is
~/Library/Preferences/com.apple.screensaver.plist
The script that has worked for me is
defaults write com.apple.screensaver askForPasswordDelay -int 0
Hope that helps :)