问题
从win10拷贝id_rsa到Mac .ssh目录,测试连通性时报错如下:
1 2 3 4 5 6 7 8 9 |
hbwb12711-2:.ssh jia$ ssh -T git@github.com @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: UNPROTECTED PRIVATE KEY FILE! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ Permissions 0644 for '/Users/jia/.ssh/id_rsa' are too open. It is required that your private key files are NOT accessible by others. This private key will be ignored. Load key "/Users/jia/.ssh/id_rsa": bad permissions git@github.com: Permission denied (publickey). |
原因
Permissions 0644 for '/Users/jia/.ssh/id_rsa' are too open.
说白了就是权限过大。
解决
查看并降低权限再测试:
1 2 3 |
ls -l ~/.ssh chmod 600 ~/.ssh/id_rsa ssh -T git@github.com |
测试成功:
1 2 |
Enter passphrase for key '/Users/jia/.ssh/id_rsa': Hi **! You've successfully authenticated, but GitHub does not provide shell access. |