You can do this using UI scripting. This requires enabled support for assistive devices in Universal Access preference pane. You can launch the script from the command line using osascript
, but you need to have a GUI session for this to work.
Based on my older answer herehere, I created the following script which works on my File Vault enabled Lion. Apparently, a checkbox to disable the password altogether was removed, either by Lion itself or me enabling File Vault 2. In the latter case I cannot fix the script for you, but the linked one might work.
Change the index (6
) of the menu item to click in the 9th line to select which of the options to choose.
tell application "System Preferences"
set current pane to pane id "com.apple.preference.security"
tell application "System Events"
tell process "System Preferences"
tell first window
tell first tab group
click radio button 1
click pop up button 1
click menu item 6 of menu of pop up button 1
end tell
end tell
end tell
end tell
quit
end tell
The following is the "official" method of changing this setting in AppleScript:
tell application "System Events" to set require password to wake of security preferences to false
It has two major problems:
- It's boolean (you cannot change the grace period)
- It doesn't work for me (it takes the place of the checkbox I don't have)