Openssh Windows 10 Issues

Warning: Unprotected Private Key File

As an avid user of OpenSSH on Windows after last update I’ve started seen this on my PowerShell:


Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions for 'C:\\Users\\My User/.ssh/id_rsa' are too open.

File System Security PowerShell Module

Because file and folder permissions are not easy with PowerShell I’m using the File System Security PowerShell Module. You can install from the gallery using the command:


Install-Module NTFSSecurity

Remember to use an elevated one :)

Removing the Warning

This warning happens when you’re not the only person that can see the file:


> Get-NTFSAccess .\id_rsa | Select Account

Account
-------
Domain\My User
Computer\admin

To remove it only your account should be able to access the file:


Remove-NTFSAccess .\id_rsa -Account Computer\admin -AccessRights FullControl

After this you should get this output:


> Get-NTFSAccess .\id_rsa | Select Account

Account
-------
Domain\My User

Bad owner or permissions on C:\Users\Users/.ssh/config

After removing the warning I couldn’t connect to the sites I had configure on my config file. Onde again the problem was on the permissions of the file.

I deleted the other users like I did on the id_rsa and everything went to normal :)


Remove-NTFSAccess .\config_rsa -Account Computer\admin -AccessRights FullControl
 
comments powered by Disqus