SSH Bad Permissions in Windows

SSH trouble in Windows paradise

Yesterday i was fiddling with Docker en Jenkins. I was busy trying to assemble a cluster of 2 CentOS 7 servers running in docker containers. I wanted to figure out how to set up a Jenkins master and slave scenario. One of the things you need to do in order to configure it is, setting up SSH access with public and private key pairs.

When I was ready to SSH into the machine I stumbled upon an error. I couldn't connect from my Windows 10 host to my CentOS server/container. That's strange because I could connect to the CentOS server with that same key from a Linux box. My .pem file on my Windows box had "Bad Permissions".

Alright, alter some permissions... That should not be so hard! This is what you have to do on Windows in order to get those permissions right. Right click on the .pem file and go to the 'Security' tab on 'Properties'. You would probably see something like this:

The trick is to only give yourself explicitly full control over the .pem file. Click 'Advanced' and 'Disable inheritance'. When Windows asks, click 'Remove all inherited permissions from object'. Click 'Ok'. No one has permission to do anything with that file. So, all you have to do now is add your user and assign 'Full control' privileges.

The end result is a .pem file that your SSH server likes!

I hope this will save you some time figuring out what to do...