我使用NameAndPassword授权插件登录OS X锁屏(the fixed version of the plugin since original is broken)。我需要它能够以某种方式访问存储的密码,目前我正试图通过使用钥匙链来实现这一点。
我设法创建了钥匙串并在里面保存了一些密码,以及访问密码所需的ACL而不提示用户。添加到ACL的任何应用程序都可以正常工作而没有提示,但是当我尝试使用此NameAndPassword授权插件访问钥匙串时,我在调用-25293 The user name or passphrase you entered is not correct
获取密码时收到SecKeychainFindGenericPassword
错误。
我尝试将/Library/Security/SecurityAgentPlugins/NameAndPassword.bundle
捆绑包和/Library/Security/SecurityAgentPlugins/NameAndPassword.bundle/Contents/MacOS/NameAndPassword
可执行文件本身添加到ACL中,但错误始终相同。
我相信这可能是因为这个插件是作为另一个用户运行的(或根本没有用户)。我该怎么做才能摆脱这个错误?或者也许不可能?在这种情况下,当它无法访问主目录时,我应该如何存储和访问此插件中的密码?我已经挣扎了几个星期了。
答案 0 :(得分:0)
检查您是否已将插件包的所有权更改为 root:wheel 使用此命令:
sudo chown -R root:wheel /Library/Security/SecurityAgentPlugins/NameAndPassword.bundle
答案 1 :(得分:0)
该插件可能需要配置为特权才能访问存储钥匙串的文件系统位置。
如果您需要访问主目录,您的机制可能需要在HomeDirMechanism之后运行。
要从钥匙串中读取,您需要先将其解锁。对于默认的登录密钥链,您通常可以使用登录窗口中的密码将其解锁,因为默认情况下它与登录密码保持同步。
您需要指定要读取的钥匙串,否则会尝试使用根用户可能不存在的默认钥匙串。
Apple的技术说明涵盖了很多关于这一主题的内容。 https://developer.apple.com/library/content/technotes/tn2228/_index.html