Select Page

I’m a big fan of Bash On Ubuntu On Windows

https://docs.microsoft.com/en-us/windows/wsl/about

and for the most part it “just works”, however I did run into an issue trying to SSH into a server using
a key rather than password. OpenSSH requires that permissions on the key file are only readable by the current user.
Trying to connect results in the following error:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: UNPROTECTED PRIVATE KEY FILE! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0555 for 'mykey.Private.openssh.ppk' 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: mykey.Private.openssh.ppk
Permission denied (publickey).

Trying to do a

chmod 600 mykey.Private.openssh.ppk

Doesn’t help, as *nix permissions don’t really map to Windows file permissions. I read some suggestions that you can adjust the permissions in Windows using the “advanced security settings” tabs in properites
but this didn’t work for me.

What did work was copying the key to the Ubuntu subsystem users home, and then chmodding that, then using that to ssh from eg:

Cp mykey.Private.openssh.ppk ~/.ssh/mykey.Private.openssh.ppk
chmod 600 ~/.ssh/mykey.Private.openssh.ppk
ssh [email protected] -i ~/.ssh/mykey.Private.openssh.ppk
%d bloggers like this: