Windows 10 上的 Ubuntu - Git 抱怨我的私钥“权限太开放”

May*_*h K 7 git ubuntu pki windows-10

一些背景信息,我在 github 上有我的 bash/vim 设置版本,我在机器之间同步。我有这个设置并在 Windows 10 PC 上工作。值得一提的是,所有这些设置都位于 %USERPROFILE% 下(请参阅

我最近在这个 Win10 机器上安装了 Ubuntu,并将 shell 用户映射到 Windows %USERPROFILE% - 非常适合一般 bash 使用,因为我现有的(Ubuntu 安装前)bash 文件无论如何都放在那里。

我已经在 SSH 上设置了 Windows GIT 命令行(%USERPROFILE%/.ssh/ 等下的公钥和私钥)。

现在谈这个问题。我启动 bash shell 并在本地存储库文件夹中执行“git pull”。期望 Ubuntu 上的 git 应该在我的 Windows %USERPROFILE% 下获取公钥/私钥。这确实发生了,但我收到了消息

root@MY_MACHINE:~/.settings# git pull
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @        
WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0777 for '/mnt/c/Users/my_user/.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. bad permissions: ignore key:
/mnt/c/Users/my_user/.ssh/id_rsa Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository
exists.
Run Code Online (Sandbox Code Playgroud)

快速检查 ~/.ssh/ 下的权限显示

root@MY_MACHINE:~/.ssh# ls -al id_*
-rwxrwxrwx 1 root root 1679 Sep 19  2016 id_rsa
-rwxrwxrwx 1 root root  402 Sep 19  2016 id_rsa.pub
Run Code Online (Sandbox Code Playgroud)

无论如何,我做什么 - 我无法将这些文件的权限更改为(例如)700。

有什么建议?当然,最终的解决方案是重新为 ubuntu-bash 设置一个单独的 $HOME。

提前致谢..

Xen*_*ier 2

看来您无法为 下的文件设置权限/mnt/c,这似乎是有道理的,因为 NTFS 似乎不理解 Ubuntu 子系统设置的 UNIX 权限。将文件移动到 FS 的根目录似乎有效,mv <keyname>.pem /然后chmod 600 /<keyname>.pem对我有用。