记录一个关于 SSH 权限的问题

将旧电脑上的 known_hosts、id_rsa、id_rsa.pub 这三个文件直接拷贝到新电脑的 .ssh 文件目录下拉取代码出现了一个报错信息:

Permissions 0644 for '/Users/apple/.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/apple/.ssh/id_rsa": bad permissions
git@codeup.aliyun.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

这个报错的意思大概就是说,id_rsa 文件的权限太高了,需要降级文件权限,于是解决方案也非常简单:
将 id_rsa 降级为 0600 就可以了

chmod 0600 ~/.ssh/id_rsa
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容