我从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文件什么权限?
我从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文件什么权限?
当前回答
提供400许可,执行以下命令
chmod 400 /Users/username/.ssh/id_rsa
其他回答
我尝试了对我的私钥进行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
我正在使用Windows 10,并尝试通过SSH连接到EC2实例。不要使用Cygwin for Windows,而是尝试使用Git Bash。在为密钥执行chmod 400之后,我可以通过SSH连接到EC2实例,但从Cygwin看,这一点不适用。Windows将.pem文件视为来自internet并阻止它,即使禁用继承也不起作用。
我将文件转换为.ppk格式,PuTTY也能正常工作,但Cygwin无法正常工作。
如果您在windows上使用WSL
最简单的答案是键入:sudo ssh-i keyfile.pem<user>@ip
而不更改文件权限。发生这种情况的原因是什么?另一种资源
您不能修改Windows文件系统上文件的权限在Windows上的Ubuntu上使用chmod on Bash。您必须复制WSL主目录(~)的私钥,并在那里执行。
另一方面,sudo不应与ssh一起使用。使用sudo发出命令之所以有效,是因为它现在很可能以root身份执行,而这不是正确的方式,并且存在巨大的安全风险,因为允许使用600/400权限以外的任何权限都会破坏使用SSH密钥的目的,从而危及密钥的安全性。
最好的方法是将文件复制到$HOME/.ssh:
cp密钥文件.pem~/.ssh
对其执行sudo chmod 400 keyfile.pem。
然后ssh-i keyfile.pem<user>@ip。
AFAIK值为:
700表示密钥文件所在的隐藏目录.ssh密钥文件id_rsa为600
0600是我的设定值(并且正在工作)