git id_rsa are too open解决方法

今天在使用Git clone项目的时候,发现出现了下面这个问题:

Cloning into 'ssd-syn'...
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0644 for '/Users/sailfish/.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/sailfish/.ssh/id_rsa": bad permissions
git@ip's password:
Permission denied, please try again.
git@ip's password:
  • 解决方法:
cd ~/.ssh
chmod 700 id_rsa
  • 最后的权限列表


    Paste_Image.png
  • 问题思考
    虽然解决了问题,但是还是不知道是什么原因导致的,rwx分别代表了读、写、执行权限,chmod 700只是添加了x的执行权限,那么id_rsa是什么文件类型?在网上没有找到答案,个人认为这个应该是一个可执行的文件,作为一个ssh连接的密钥存储的文件,认证的时候应该是需要执行的(可能不对),有了解的同学解释一下。

  • 贴下在stackoverflow答案

地址:http://stackoverflow.com/questions/1556119/ssh-private-key-permissions-using-Git-gui-or-ssh-keygen-are-too-open

You changed the permissions on the whole directory, which I agree with Splash is a bad idea. If you can remember what the original permissions for the directory are, I would try to set them back to that and then do the following

cd ~/.ssh
chmod 700 id_rsa

inside the .ssh folder. That will set the id_rsa file to rwx (read, write, execute) for the owner (you) only, and zero access for everyone else.
If you can't remember what the original settings are, add a new user and create a set of SSH keys for that user, thus creating a new .ssh folder which will have default permissions. You can use that new .ssh folder as the reference for permissions to reset your .ssh folder and files to.
If that doesn't work, I would try doing an uninstall of msysgit, deleting ALL .ssh folders on the computer (just for safe measure), then reinstalling msysgit with your desired settings and try starting over completely (though I think you told me you tried this already).
Edited: Also just found this link via Google -- Fixing "WARNING: UNPROTECTED PRIVATE KEY FILE!" on Linux While it's targeted at linux, it might help since we're talking liunx permissions and such.

你可能感兴趣的:(git id_rsa are too open解决方法)