Editing Keychain - Changing Key Access Control through command line

othernamen
New Contributor II

Hey,

I'm looking to how the following be achieved through command line (updating Access Control of the key):

Keychain Access --> System --> double click on the key --> Access Control tab --> change option to "Allow all applications to access this item" or add an application.

Thanks!

1 REPLY 1

mm2270
Legendary Contributor III

It's been a while since I've looked at this, but if I'm remembering correctly, that can only be set at the time a keychain entry is created when using the security command line tool. I don't believe you can make changes to it after the fact. But I would need to go back and look to be sure. In any event, you should check on the man page on security in Terminal for more information on how to use it.

Edit: I forgot that the security tool commands for add-generic-password and add-internet-password both have an "update" flag (-U), which supposedly updates an existing entry with new values, but in quick tests I've been unable to get that to work, at least when talking about changing the application access settings.