7

Some background information, I have my bash/vim settings versioned on github that I sync between machines. I have this setup in place and working on a Windows 10 PC. It's relevant to mention that all of this set up lives under %USERPROFILE% (see this)

I recently installed Ubuntu on this Win10 box and mapped the shell user to Windows %USERPROFILE% - works perfectly for general bash usage since my existing (pre-Ubuntu install) bash files were sitting there anyway.

I already have my Windows GIT command line setup working over SSH (public and private keys under %USERPROFILE%/.ssh/ etc).

Now on to the issue. I start the bash shell and execute a "git pull" inside my local repository folder. The expectation is that git on Ubuntu should pick up the Public/ Private Keys under my Windows %USERPROFILE%. This does happen but I get the message

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.

A quick check of permissions under ~/.ssh/ reveals

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

No matter, what I do - I cannot change the permissions on these files to (say) 700.

Any suggestions? Of course, the final solution is to go back to having a separate $HOME for ubuntu-bash.

Thanks in advance..

Mayuresh K
  • 171
  • 1
  • 2
  • 9
  • I know this is an old question, but:  Have you looked at the permissions on the files and the ```.ssh``` directory in the “Security” tab of the Windows Explorer Properties window?  Is there any way they could be interpreted as being open to the world?  Have you tried turning off “Include inheritable permissions from this object’s parent” for the directory, and turning off execute permission for yourself on the files? – Scott - Слава Україні Nov 24 '17 at 18:35

1 Answers1

2

It seems you can't set permissions for files under /mnt/c, which makes sense seeming as NTFS doesn't seem to understand UNIX permissions set by the Ubuntu subsystem. Moving the file to root of the FS seems to work, mv <keyname>.pem / followed by chmod 600 /<keyname>.pem worked for me.

Xenxier
  • 131
  • 4