Have you tried using a boolean with a value of False instead of an integer of 0 for the "askForPassword" key? I say this because I built a profile for the opposite recently with Profile Manager, which put in a <true/> instead of an integer.
<dict>
<key>askForPassword</key>
<false/>
</dict>
I have. However, when i imported it, it turned it into a 0 in the config profile.
Edit: I'm sorry...when the profile is sent to the Mac, it turns it into a 0. Still doesn't affect the "Require Password" check box, it remains checked.
"False" does work, I tested it with a manual config profile that I installed with the Profiles command. The issue here is that Apple's handling of that setting is *really* flaky. I had to clear out another profile we used to set it as "True" then reboot before installing the "False" profile. It really wanted to stay checked.
I've seen the flakiness with this setting and config profiles, and wrote my own launchd/script combo.
Since it's a launchd, the script runs as the user and applies that setting for the user. User may be able to go change the setting (askForPassword/askForPasswordDelay), but the next time they log in, the script runs and sets default values.
Let me know if you would like me to post the launchd/script here.
Is there any chance there's a configuration profile (Computers > Configuration Profiles > Security & Privacy) coming down that is changing this setting (Require password after sleep or screen saver begins)? Also, I do have at least one memorable instance where a configuration profile I have created ends up with information from a category it isn't configured to have once it makes its way to the Mac side. Do you see anything wacky under System Preferences > Profiles? Like Security & Privacy settings configured under a configuration profile that shouldn't have any?
@RobertHammen I'd like to see your login script for this if you don't mind.
I had a similar issue in one of our labs. I ended up using the following in a script at login:
LOGGEDIN=who | grep console | awk '{print $1}'
sudo -u $LOGGEDIN osascript -e 'do shell script "defaults write com.apple.screensaver askForPassword 0"'
Since the script was running as root, I tried using the standard:
su $LOGGEDIN defaults write com.apple.screensaver askForPassword 0
, but for some reason it didn't take. I ended up wrapping it in an AppleScript call, which for some reason seemed to work. I did find that preference caching seemed to take over and it would only take affect after a reboot. Hope this helps someone.
@jhuhmann posted it in another thread:
Discussion