top of page

Changing The Login.Keychain Settings From The Command Line

We love to programmatically manipulate all the things. That's kinda' what programmers do. But unfortunately, changing specific settings for login.keychain directly from the command line is not possible due to security restrictions. The login.keychain stores sensitive information like passwords and access tokens (and we at Secret Chest use it as a database of sorts) and direct access through the command line would bypass essential security measures. Still, there are useful settings on the global login.keychain, like the inactivity lock:

However, depending on what you want to achieve, there might be alternative solutions using the command line. One is to make a new keychain that has the settings you want and then use that in larger scale deployment settings. These include:

1. Change the default keychain:

If you want to set a different keychain as the default one for storing passwords and other credentials, you can use the following command:

security default-keychain -s "/path/to/new.keychain"

Remember to replace /path/to/new.keychain with the actual path to your desired keychain.

2. Reset the keychain:

This will erase all data from the login.keychain, including passwords and access tokens. Use this option with caution:

security delete-keychain -d login.keychain

3. Modify specific keychain items:

While you cannot directly modify settings, you can access and modify individual items within the keychain using the security find-generic-password and security add-generic-password commands. However, this requires knowing the existing password for the item, so we won't go further into that right now.

4. Use Keychain

For most keychain management tasks, it's recommended to use the Keychain Access application. It provides a secure and user-friendly interface to view, modify, and delete keychain items, including settings like access control and automatic locking.

Important notes:

  • Modifying keychain settings can have security implications, so proceed with caution and only when the risks involved are understood.

  • Always back up the keychain before making any significant changes.

  • For further assistance with specific keychain tasks, consider consulting Apple's official documentation or seeking help from a qualified IT professional.

105 views0 comments

Recent Posts

See All


bottom of page