macOS keychain settings.
Lock keychain, or the default keychain if none is specified. If the -a option is specified, all keychains are locked. lock-keychain [-h] [-a|keychain] Unlock keychain, or the default keychain if none is specified. unlock-keychain [-hu] [-p password] [keychain] Set settings for keychain, or the default keychain if none is specified. set-keychain-settings [-hlu] [-t timeout] [keychain] Set password for keychain, or the default keychain if none is specified. set-keychain-password [-h] [-o oldPassword] [-p newPassword] [keychain] Show the settings for keychain. show-keychain-info [-h] [keychain] Dump the contents of one or more keychains. dump-keychain [-adhir] Options -a for dump-keychain: dump access control list of items. for lock-keychain: all keychains are locked. -d Dump (decrypted) data of items. -h Display help. -i Interactive access control list editing mode -l Lock keychain when the system sleeps. -u Lock keychain after timeout interval. -o oldPassword Old keychain password (if not provided, will prompt) -p newPassword New keychain password (if not provided, will prompt) -r Dump raw (encrypted) data of items. -t timeout Specify timeout interval in seconds (omitting this option specifies "no timeout").
Print all passwords stored in the default keychain this will prompt for a password (unless the keychain is already unlocked):
security dump-keychain -d ~/Library/Keychains/login.keychain
“Security is mostly a superstition. It does not exist in nature, nor do the children of men as a whole experience it. Avoiding danger is no safer in the long run than outright exposure. Life is either a daring adventure, or nothing” ~ Helen Keller
Local man page: security - Command line help page on your local machine.
security - Administer Keychains, keys, certificates and the Security framework.