我从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文件什么权限?
当前回答
对于我(使用Windows的Ubuntu子系统),错误消息更改为:
Permissions 0555 for 'key.pem' are too open
在使用chmod 400之后。事实证明,使用root作为默认用户是原因。
使用cmd:
ubuntu config --default-user your_username
其他回答
提供400许可,执行以下命令
chmod 400 /Users/username/.ssh/id_rsa
密钥只需由您读写:
chmod 600 ~/.ssh/id_rsa
或者,密钥只能由您读取(这也会阻止您的写访问):
chmod 400 ~/.ssh/id_rsa
600在大多数情况下似乎更好,因为您不需要稍后更改文件权限来编辑它
手册页中的相关部分(man-ssh)
~/.ssh/id_rsa包含用于身份验证的私钥。这些文件包含敏感数据,用户应能阅读,但不能其他人可以访问(读/写/执行)。ssh只会忽略私有密钥文件(如果是)其他人可以访问。可以指定生成将用于加密敏感密钥的密钥时的密码短语此文件的一部分使用3DES。~/.ssh/identity.pub~/.ssh/id_dsa.pub~/.ssh/id_ecdsa.pub~/.ssh/id_rsa.pub包含用于身份验证的公钥。这些文件不敏感任何人都可以(但不需要)阅读。
我在windows 10中遇到了错误,因此我将权限设置为如下,并且可以正常工作。
详细信息,请删除其他用户/组,直到它只有“SYSTEM”和“Administrators”。然后将您的windows登录名添加到只有“读取”权限的窗口中。
请注意,id_rsa文件位于c:\users\<username>文件夹下。
700 folder
644 id_rsa.pub
这对我有用。
我尝试了对我的私钥进行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