Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 https://superuser.com/questions/348694/bad-owner-or-permissions-error-using-cygwins-ssh-exe and https://serverfault.com/questions/253313/ssh-returns-bad-owner-or-permissions-on-ssh-config 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

like image 630
gary69 Avatar asked Apr 19 '18 16:04

gary69


2 Answers

This started popping up immediately after I created another user with Administrator privileges, and that account began inheriting access to my .ssh folder.

You do not need to change your permissions whatsoever.

Just go to .ssh, right-click Properties, Security Tab, Advanced. DISABLE INHERITANCE, then click on the Administrator user (the one that is not you) and Remove them. Apply. Done.

like image 154
Jason Hughes Avatar answered Sep 21 '22 15:09

Jason Hughes


Changing the ssh client from C:\Windows\System32\OpenSSH\ssh.exe to C:\Program Files\Git\usr\bin\ssh.exe worked for me.

like image 33
Gerard Carbó Avatar answered Sep 20 '22 15:09

Gerard Carbó