我从ssh收到以下错误:

Permissions 0777 for '/Users/username/.ssh/id_rsa' are too open.
It is recommended that your private key files are NOT accessible by others.
This private key will be ignored.

我应该授予id_rsa文件什么权限?


当前回答

我正在使用Windows 10,并尝试通过SSH连接到EC2实例。不要使用Cygwin for Windows,而是尝试使用Git Bash。在为密钥执行chmod 400之后,我可以通过SSH连接到EC2实例,但从Cygwin看,这一点不适用。Windows将.pem文件视为来自internet并阻止它,即使禁用继承也不起作用。

我将文件转换为.ppk格式,PuTTY也能正常工作,但Cygwin无法正常工作。

其他回答

我尝试了对我的私钥进行600级的权限,结果成功了。

chmod 600 privateKey 
[dev]$ ssh -i privateKey user@ip

另一方面

chmod 755 privateKey 
[dev]$ ssh -i privateKey user@ip

给出以下问题:

Permissions 0755 for 'privateKey' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
Load key "privateKey": bad permissions

这是对我有用的(在mac上)

sudo chmod 600 path_to_your_key.pem 

那么:

ssh -i path_to_your_key user@server_ip

希望能有所帮助

我在windows 10中遇到了错误,因此我将权限设置为如下,并且可以正常工作。

详细信息,请删除其他用户/组,直到它只有“SYSTEM”和“Administrators”。然后将您的windows登录名添加到只有“读取”权限的窗口中。

请注意,id_rsa文件位于c:\users\<username>文件夹下。

700  folder
644  id_rsa.pub

这对我有用。

对于我(使用Windows的Ubuntu子系统),错误消息更改为:

 Permissions 0555 for 'key.pem' are too open

在使用chmod 400之后。事实证明,使用root作为默认用户是原因。

使用cmd:

 ubuntu config --default-user your_username