【发布时间】:2017-02-22 12:46:00
【问题描述】:
我正在使用 BitVise 与我的 AWS 实例进行通信。
从前两天开始,我无法使用 pem 文件登录。从aws得到日志如下,
Starting sshd: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: UNPROTECTED PRIVATE KEY FILE! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0777 for '/etc/ssh/ssh_host_rsa_key' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
bad permissions: ignore key: /etc/ssh/ssh_host_rsa_key
Could not load host key: /etc/ssh/ssh_host_rsa_key
不幸的是,错误是通过将 777 设置为 ssh 而发生的。
现在有什么解决方案?无法使用 SSHClient 进行连接以使权限为 400。
这不是pem文件权限的问题,目录ssh的权限是777。
【问题讨论】:
-
这是私钥(您在本地拥有),而不是公钥(位于实例上)。您只需要将本地 pem 文件的权限更改为
0600否则 OpenSSH 将拒绝使用它。 -
那个问题提到了“~/.ec2/id_rsa-gsg-keypair”。这个问题是关于 /etc/ssh/ssh_host_rsa_key 中的服务器私钥