{"id":37,"date":"2007-11-09T19:32:06","date_gmt":"2007-11-09T11:32:06","guid":{"rendered":"http:\/\/blog.pighead.cc\/whsyu\/2007\/11\/09\/37\/"},"modified":"2011-01-26T19:09:05","modified_gmt":"2011-01-26T11:09:05","slug":"access-keychain-cli","status":"publish","type":"post","link":"https:\/\/blog.pighead.cc\/whsyu\/2007\/11\/09\/access-keychain-cli\/","title":{"rendered":"\u5f9e Command Line \u5b58\u53d6 Keychain \u7684\u65b9\u6cd5"},"content":{"rendered":"<p class=\"bb-post-separator\"><strong>[\u83ef\u8a9e, cmn-Hant-TW]  <\/strong><\/p><p>\u5176\u5be6\u4e3b\u8981\u662f\u8aaa\u5728\u5beb shell scripts \u7684\u6642\u5019\u6703\u6bd4\u8f03\u65b9\u4fbf\u5566\uff0c\u9019\u6a23\u7e3d\u6bd4\u76f4\u63a5\u628a\u5bc6\u78bc\u4e4b\u985e\u7684\u5b58\u5728\u6a94\u6848\u88e1\u4f86\u5f97\u5b89\u5168\u4e9b\u3002\u00a0\u5728 shell \u4e2d\u53ef\u4ee5\u7528 service \u5c0d Keychain \u505a\u5b58\u53d6\uff0c\u53ef\u4ee5\u8a2d\u5f88\u591a\u4e0d\u540c\u7684\u689d\u4ef6\u4f86\u53d6\u5f97 Keychain \u4e0a\u7684\u8cc7\u6599\u3002\u800c\u5982\u679c\u8981\u76f4\u63a5\u62ff\u5230\u5bc6\u78bc\uff0c\u9019\u6a23\u6253\u5c31\u53ef\u4ee5\u4e86\uff1a<\/p>\n<pre lang=\"bash\"> security -q find-internet-password -s $name -g 2&gt;&amp;1\u00a0\u00a0| grep password | cut -d \\\" -f 2 <\/p>\n<p>\u7136\u5f8c\u6703\u6709\u8996\u7a97\u8df3\u51fa\u4f86\u63d0\u793a\u8aaa\u6709\u7a0b\u5f0f\u60f3\u6293\u8cc7\u6599\uff0c\u9078\u78ba\u5b9a\u5373\u53ef\u3002<br \/>\n\u8981\u6ce8\u610f\u7684\u662f\u9019\u6a23\u771f\u7684\u5c31\u6703\u628a\u5bc6\u78bc\u6316\u51fa\u4f86\uff0c\u6240\u4ee5\u4f7f\u7528\u4e0a\u52d9\u5fc5\u5c0f\u5fc3\u5c31\u662f\u4e86\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>[\u83ef\u8a9e, cmn-Hant-TW] \u5176\u5be6\u4e3b\u8981\u662f\u8aaa\u5728\u5beb shell scripts \u7684\u6642\u5019\u6703\u6bd4\u8f03\u65b9\u4fbf\u5566\uff0c\u9019\u6a23\u7e3d\u6bd4\u76f4\u63a5\u628a\u5bc6\u78bc\u4e4b\u985e\u7684\u5b58\u5728\u6a94\u6848\u88e1\u4f86\u5f97\u5b89\u5168\u4e9b\u3002\u00a0\u5728 shell \u4e2d\u53ef\u4ee5\u7528 service \u5c0d Keychain \u505a\u5b58\u53d6\uff0c\u53ef\u4ee5\u8a2d\u5f88\u591a\u4e0d\u540c\u7684\u689d\u4ef6\u4f86\u53d6\u5f97 Keychain \u4e0a\u7684\u8cc7\u6599\u3002\u800c\u5982\u679c\u8981\u76f4\u63a5\u62ff\u5230\u5bc6\u78bc\uff0c\u9019\u6a23\u6253\u5c31\u53ef\u4ee5\u4e86\uff1a security -q find-internet-password -s $name -g 2&gt;&amp;1\u00a0\u00a0| grep password | cut -d \\&#8221; -f 2 \u7136\u5f8c\u6703\u6709\u8996\u7a97\u8df3\u51fa\u4f86\u63d0\u793a\u8aaa\u6709\u7a0b\u5f0f\u60f3\u6293\u8cc7\u6599\uff0c\u9078\u78ba\u5b9a\u5373\u53ef\u3002 \u8981\u6ce8\u610f\u7684\u662f\u9019\u6a23\u771f\u7684\u5c31\u6703\u628a\u5bc6\u78bc\u6316\u51fa\u4f86\uff0c\u6240\u4ee5\u4f7f\u7528\u4e0a\u52d9\u5fc5\u5c0f\u5fc3\u5c31\u662f\u4e86\u3002<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[200],"tags":[168,4271],"class_list":["post-37","post","type-post","status-publish","format-standard","hentry","category-development","tag-mac-os-x","tag-shell-scripts"],"_links":{"self":[{"href":"https:\/\/blog.pighead.cc\/whsyu\/wp-json\/wp\/v2\/posts\/37","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.pighead.cc\/whsyu\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.pighead.cc\/whsyu\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.pighead.cc\/whsyu\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.pighead.cc\/whsyu\/wp-json\/wp\/v2\/comments?post=37"}],"version-history":[{"count":3,"href":"https:\/\/blog.pighead.cc\/whsyu\/wp-json\/wp\/v2\/posts\/37\/revisions"}],"predecessor-version":[{"id":1150,"href":"https:\/\/blog.pighead.cc\/whsyu\/wp-json\/wp\/v2\/posts\/37\/revisions\/1150"}],"wp:attachment":[{"href":"https:\/\/blog.pighead.cc\/whsyu\/wp-json\/wp\/v2\/media?parent=37"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.pighead.cc\/whsyu\/wp-json\/wp\/v2\/categories?post=37"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.pighead.cc\/whsyu\/wp-json\/wp\/v2\/tags?post=37"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}