delay for password prompt

Valued Contributor II

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/$MAC_UUID "askForPasswordDelay" -int 1

Legendary Contributor III

Any reason you're putting that into the ByHost preference? I don't think it goes there. Try plugging it into the regular 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?

Contributor II

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>

"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.

Valued Contributor III

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).


Legendary Contributor III

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 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.

Contributor III

The preference file that is written to is


The script that has worked for me is

defaults write askForPasswordDelay -int 0

Hope that helps :)