我们使用 SSH 连接到 MAC 并运行包含该行的脚本
security unlock-keychain -p XXX
Run Code Online (Sandbox Code Playgroud)
但是由于我们将机器更新为“macOS Sierra”,因此出现错误
security: SecKeychainUnlock <NULL>: The user name or passphrase you entered is not correct.
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
当您通过 SSH 连接时,它似乎security不知道登录用户的钥匙串:如果您发出security list-keychains命令,您只会看到系统钥匙串,而不是用户的钥匙串。
您需要做的是指定要解锁的钥匙串文件:
security unlock-keychain -p XXX "keychain_path_here"
Run Code Online (Sandbox Code Playgroud)
哪里keychain_path_here有类似的东西/Users/username/Library/Keychains/login.keychain-db。