To install powershell either download the zip/msi from github page or you can install thru chocolatey. But I preferred going with msi file for now.
The claim is that you can run powershell core side-by-side, which is not a requirement for me- but wanted to move over to it for some time now.
Anyway, I installed this in C:\PowerShell\6.0.1 directory & added it to Path environment variable on the machine- so is accessible to all uesrs.
So far it is all working quite well. One of the things I like is the to bring my bag of scripts. One such is to list all the files in current directory as full path.
Now I already had rsa keys generated thru putty, thus using the .ssh directory as it is.
Similar to pwsh, downloaded the binaries from Win32-OpenSSH git repository. Installed it in directory C:\Program Files\OpenSSH-Win64 and added it to Path environment variable at machine level.
cd 'C:\Program Files\OpenSSH-Win64'pwsh.exe-ExecutionPolicyBypass-Fileinstall-sshd.ps1# this will register the ssh-agent service to be started # automatically on reboot, and will start it if not already runningSet-Servicessh-agent-StartupTypeAutomatic
Now the most important part is setting up the access permissions on private keys, without it ssh-add will just reject the keys!
On *nix systems you can setup correct permissions with chmod, but windows is a different ball game. I tried chmod thru pwsh and ubuntu as wsl without success. It was much easier to change change the directory permissions.
The idea is that your files in ~\.ssh should not inherit permissions and MUST be accessible by just you. Plus they MUST not be modifiable- just readable.
Note: this MUST be done for all of the following:
private keys
public keys
config file
Once this was done I was able to get past this error and things worked quite well.