macos KeyChain Security 命令行工具适用于 find-internet-passwords 但不适用于 find-generic-passwords
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8303755/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
KeyChain Security command line tool works with find-internet-passwords but not find-generic-passwords
提问by Travis
Looking into using the command line tool for KeyChain. I am able to do a lot of the things through security; listing my multiple keychains, dumping them and setting defaults. Reading through tutorials and other postings I expect to find my passwords with
研究使用 KeyChain 的命令行工具。我能够通过安全来做很多事情;列出我的多个钥匙串,转储它们并设置默认值。通读教程和其他帖子,我希望找到我的密码
security find-generic-password test
security find-generic-password test
But I get
但我得到
security: SecKeychainSearchCopyNext: The specified item could not be found in the keychain.
安全性:SecKeychainSearchCopyNext:在钥匙串中找不到指定的项目。
This won't work in my default keychain or login.keychain. However, I am able to find my passwords listed as 'internet' with find-internet-password command. Can anyone explain why or what I am doing wrong? Sites I've been reading is the man page and http://blog.macromates.com/2006/keychain-access-from-shell/,
这在我的默认钥匙串或 login.keychain 中不起作用。但是,我可以使用 find-internet-password 命令找到列为“internet”的密码。谁能解释为什么或我做错了什么?我一直在阅读的网站是手册页和http://blog.macromates.com/2006/keychain-access-from-shell/,
回答by Karoy Lorentey
Generic passwords are identified by their Service and Account attributes. For example, to search for a password for account "bar" of the "foo" service, use
通用密码由其服务和帐户属性标识。例如,要搜索“foo”服务的帐户“bar”的密码,请使用
security find-generic-password -a foo -s bar -g
The -g
option displays the value of the password at the end of the output.
该-g
选项在输出的末尾显示密码的值。
The combination of service and account is guaranteed to uniquely identify a particular password. Other queries (comment, label, etc.) are possible, but they may match multiple passwords. find-generic-password
displays only the first single matching item, which limits its usefulness for such queries.
服务和帐户的组合保证唯一标识特定密码。其他查询(评论、标签等)也是可能的,但它们可能匹配多个密码。find-generic-password
仅显示第一个匹配项,这限制了它对此类查询的用处。