Win10 .ssh/id_rsa bad permission问题。

win10配置ssh免密登录后,可能出现 xxx/.ssh/id_rsa 或 xxx/.ssh/config 文件 “Bad permission”问题,这是因为相应的文件的权限不对,即除了owner外其它用户有该文件的访问权限。

解决的原理是取消其它用户的访问权限。

过程:

1. cmd.exe,目的是在命令行中去掉相关文件继承得到的权限,否则下一步中无法编辑。

cd xxx/.ssh

icacls config /grant everyone:f 

icacls config /inheritance:d 

icacls config /remove everyone

关于icacls请参考https://docs.microsoft.com/zh-cn/windows-server/administration/windows-commands/icacls

2. 文件浏览器中,选中该文件然后右键---->属性---->安全---->编辑 去掉其它用户的所有权限,只给owner读和写的权限。

posted @ 2019-10-15 13:32  耕读编码  阅读(3009)  评论(0编辑  收藏  举报