Yosemite - Require password after sleep is disabled

Run in Terminal

defaults write com.apple.screensaver askForPassword -bool false

Using defaults write no longer works as of 10.13.

https://blog.kolide.com/screensaver-security-on-macos-10-13-is-broken-a385726e2ae2 http://www.openradar.me/35462422

For those who have been searching for a way to do this via profiles, you can use this gist: https://gist.github.com/mcw0933/21b8a9e292e83c69931f5de0d2ae1883

Or follow these steps:

  1. Create a file called askforpassworddelay.mobileconfig with the xml file contents below.
  2. Change __YOUR_NAME__ to something more meaningful if you like.
  3. Change the askForPasswordDelay value to your desired setting, in seconds. In the file below, it's 5 seconds.
  4. Save the file.
  5. Open a terminal window, change directory to the file location, and run /usr/bin/profiles -I -F askforpassworddelay.mobileconfig. Or, launch the Profiles prefpane in System Preferences and then use the UI to install this file manually.

File contents:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>PayloadContent</key>
  <array>
    <dict>
      <key>PayloadDisplayName</key>
      <string>Security &amp; Privacy</string>
      <key>PayloadEnabled</key>
      <true/>
      <key>PayloadIdentifier</key>
      <string>com.__YOUR_NAME__.config.screensaver</string>
      <key>PayloadType</key>
      <string>com.apple.screensaver</string>
      <key>PayloadUUID</key>
      <string>966eb7be-81bd-f8cc-f3e3-078d93f1b4a4</string>
      <key>PayloadVersion</key>
      <integer>1</integer>
      <key>askForPassword</key>
      <true/>
    </dict>
    <dict>
      <key>PayloadDisplayName</key>
      <string>Security &amp; Privacy</string>
      <key>PayloadEnabled</key>
      <true/>
      <key>PayloadIdentifier</key>
      <string>com.__YOUR_NAME__.config.screensaver</string>
      <key>PayloadType</key>
      <string>com.apple.screensaver</string>
      <key>PayloadUUID</key>
      <string>966eb7be-81bd-f8cc-f3e3-078d93f1b4a5</string>
      <key>PayloadVersion</key>
      <integer>1</integer>
      <key>askForPasswordDelay</key>
      <integer>5</integer>
    </dict>
  </array>
  <key>PayloadDescription</key>
  <string>screen saver password delay settings</string>
  <key>PayloadDisplayName</key>
  <string>screen saver password delay</string>
  <key>PayloadIdentifier</key>
  <string>com.__YOUR_NAME__.config.screensaver</string>
  <key>PayloadOrganization</key>
  <string>__YOUR_NAME__</string>
  <key>PayloadRemovalDisallowed</key>
  <false/>
  <key>PayloadScope</key>
  <string>System</string>
  <key>PayloadType</key>
  <string>Configuration</string>
  <key>PayloadUUID</key>
  <string>0dc319a0-c331-0131-eeb5-000c294ab81b</string>
  <key>PayloadVersion</key>
  <integer>1</integer>
</dict>
</plist>