假设我获得了下面的 ssh。
ssh -i keypair.pem <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="02706d6d76426761302f30322f30332f3331352f3036372c616d6f727776672f332c636f63786d6c6375712c616d6f" rel="noreferrer noopener nofollow">[email protected]</a>
我想将其保存在/Users/UserName/Documents/ServerKeys
我相信我会将其添加到 ssh key
ssh -i ~/Documents/ServerKeys/keypair.pem <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="384a57574c785d5b0a150a08150a0915090b0f150a0c0d165b5755484d4c5d150916595559425756594f4b165b5755" rel="noreferrer noopener nofollow">[email protected]</a>
当我在终端中运行它时,我得到
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: UNPROTECTED PRIVATE KEY FILE! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0644 for '/Users/UserName/Documents/ServerKeys/keypair.pem' are too open.
It is recommended that your private key files are NOT accessible by others.
This private key will be ignored.
bad permissions: ignore key: /Users/UserName/Documents/ServerKeys/keypair.pem
Permission denied (publickey).
我需要在某个时候运行 chmod 400 keypair.pem 吗?
我做错了什么,我还需要做什么才能使用 key 对进入服务器?
最佳答案
是的,您应该确保文件的权限是安全的。使用 0644 模式,系统上的任何其他人都可以读取 key 并使用它连接到远程系统。将其设置为 0600 确保您且只有您可以读取和写入该文件(root
除外)。
关于ssh - 如何连接独立的 SSH 客户端 - AWS EC2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10625664/