将管理员密码存储在 OSX 钥匙串中以实现某些流程的自动化?
我需要在登录时运行一系列命令,其中许多命令需要 root 权限。因此,为了节省几个步骤,我将它们全部放入一个苹果脚本中,这样我就不必打开终端了。
但是,我仍然希望能够在根本不输入密码的情况下执行此操作(我喜欢在我还在睡觉时一大早就启动我的机器)。所以我想,为什么不将我的管理员密码存储在钥匙串中并让脚本访问该密钥。
但这感觉不对,将管理员密码存储在钥匙串中......
那么,您有什么想法?这是授予我的程序许可的可接受的方法吗?如果 applescript 不够安全,我可以使用一个简单的 cocoa 应用程序轻松完成此操作。
I have a whole series of commands that I need to run on login, many of which require root privileges. So, to save a few steps I put them all into one apple script so I wouldn't have to open the terminal.
But still, I'd like to be able to do this without entering my password at all (I like to boot my machine early AM while I'm still sleeping). So I thought, why not just store my admin password in the keychain and have the script access that key.
But this just feels wrong, storing the admin password in keychain...
So, what are your thoughts? Is this an acceptable method of giving my program permission? If applescript isn't secure enough, I could easily do this with a simple cocoa app.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我自己做这个。我存储其他计算机的管理员密码,以便我可以使用 applescript 脚本在我的局域网上自动挂载共享。在我看来,如果钥匙串足够安全,可以保存任何密码,那么它也必须足够安全,可以保存所有密码。密码永远不会以明文显示,所以我没有看到问题。
当然,当有人直接访问您的计算机时,总会存在安全风险。如果他们知道存储密钥的名称并且他们正在从您的管理员帐户访问钥匙串,则他们可以运行 applescript 将您的密码从钥匙串中提取出来。但如果有人拥有如此多的访问权限,那么您的计算机无论如何都不安全。
I do this myself. I store admin passwords for other computers so I can auto-mount shares over my lan using applescript scripts. In my opinion, if the keychain is secure enough to hold any password then it must be secure enough to hold all passwords. The password is never displayed in the clear so I don't see a problem.
Of course there's always a security risk when someone has direct access to your computer. They can run an applescript to pull your password out of the Keychain if they know the name of the key where it is stored and they are accessing the keychain from your admin account. But if someone has that much access then your computer isn't safe anyway.