Security – How to Use ‘security set-keychain-settings’ to Prevent Locking

keychainSecurity

The command line tool security set-keychain-settings provides options for

  • locking when the system sleeps (-l) and
  • locking after a timeout (-u)

but does not seem to provide any options for reversing these settings?

How to I use security set-keychain-settings to disable these options?

Best Answer

If you run security set-keychain-settings without anything else it will turn off both "Lock when sleeping" and "Lock after minutes of inactivity" for the 'login' Keychain. It will also set the default number of minutes back to 5.

From there you can turn on whatever settings you want.