MacOS – Make /usr/bin/security ask for Touch ID verification

command linekeychainmacosSecuritytouch-id

I can add a password to the keyring like this:

security add-generic-password -a $USER -s my-password-entry -T /usr/bin/security -U -w

… and read it like this:

security find-generic-password -a $USER -s my-password-entry -g -w

But is there a way to make security ask for Touch ID verification every time I ask for my-password-entry?

References:

Best Answer

Yes, you can modify your command line to look like this when adding the password:

security add-generic-password -a $USER -s my-password-entry -T "" -U -w

This will ensure that no application is trusted to access the data without warning.