Windows – openssh windows bad owner or permissions


I've installed openssh for windows and when I run ssh localhost I get

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

I've looked at these 2 questions "Bad owner or permissions" error using Cygwin's ssh.exe and but none of the answers work for me. sshd is running as a service as the Local System user. I've run chmod 0600 C:\Users\gary\.ssh\config and chown gary C:\Users\gary\.ssh\config. I've also cleared the ACL by running setfacl -b C:\Users\gary\.ssh\config and then chmod 0600 C:\Users\gary\.ssh\config again. I've also tried changing the owner to SYSTEM and got the same error.

I'm not sure what else to do, is there anything wrong with my setup? I also have git installed which installed mingw, I deleted ssh and sshd from my git installation so they wouldn't be on my path.

Other commands I've run are
icacls "C:\Users\gary\.ssh\config" /setowner gary
chown -R gary:1049089 C:\Users\gary\.ssh

ls -la C:\Users\gary\.ssh\config shows

-rw-r–r– 1 gary 1049089 229 Jan 3 14:43 'C:\Users\gary.ssh\config'

it keeps showing this even after changing the owner to SYSTEM, but in the file properties in file explorer it shows SYSTEM as the owner

Best Answer

I set the owner and permissions of C:\Users\<me>\.ssh (and all child objects, including config) to <me> (and removed all previous permissions, in my case it was SYSTEM, Administrators and some other stuff), and it worked!

So it needs to be just <your-username>.

But then I encountered another error which was that it didn't recognize any of my existing keys, which were created with RSA. Currently it only understand Ed25519 which you can test by running ssh-keygen -t rsa and it'll give you an error saying "unknown key type rsa". There's an open issue on github.