Command: security dump-keychain
What it does: This command dumps the contents of the keychain to the console, showing all stored passwords, certificates, and other secure items.
Example:
Let’s say you want to view a list of all stored passwords in your default keychain. You can use the security
command:
- Open Terminal on your MacOS machine.
- Type in the following command:
security dump-keychain
- Press Enter to run the command.
Result: The output will display a list of all stored passwords, certificates, and other secure items in the default keychain.
Tips:
- To view more information about each item, use the
-p
option followed by thesecurity dump-keychain
command. For example:security -p dump-keychain
- To view a specific type of item (e.g., only passwords), use the
-s
option followed by thesecurity dump-keychain
command and the type of item. For example:security -s password dump-keychain
- To delete a specific item from the keychain, use the
security
command with the-v
option and the-l
option to list all items first. For example:security -v -l | grep "item_to_delete"
Trick:
To generate an encryption password for your keychain using a strong random password generator, you can use the following trick:
- Open Terminal and type in the following command:
openssl rand -base64 32
- Replace the generated password with a new one of your choice.
- Save this password securely (e.g., on an encrypted note-taking app).
This will generate a strong random encryption password that you can use to secure your keychain.
Note: Be aware that dumping the contents of the keychain will display all stored passwords and other secure items in plain text, so be sure to only run this command when necessary and securely store any generated passwords.
This trick uses the security
command to interact with the keychain on your system, including dumping its contents and deleting specific
items.