我从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文件什么权限?


当前回答

另一个技巧是在下载文件夹中执行此操作。从AWS EC2实例下载私钥后,文件将位于该文件夹中,然后只需键入命令

ssh-keygen -y -f myprivateKey.pem > mypublicKey.pub

其他回答

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

sudo chmod 600 path_to_your_key.pem 

那么:

ssh -i path_to_your_key user@server_ip

希望能有所帮助

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

 Permissions 0555 for 'key.pem' are too open

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

使用cmd:

 ubuntu config --default-user your_username
700  folder
644  id_rsa.pub

这对我有用。

0600是我的设定值(并且正在工作)

适用于Windows 8.1的独立于区域设置的解决方案是:

chgrp 545 ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa

GID 545是一个特殊的ID,它总是指“用户”组,即使您的语言环境使用了不同的“用户”。