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讀和寫的權限。