openssh windows bad owner or permissions
Solution 1
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.
Solution 2
Changing the ssh client from C:\Windows\System32\OpenSSH\ssh.exe to C:\Program Files\Git\usr\bin\ssh.exe worked for me.
Solution 3
Just got same issue after re-install windows. And easily fixed just by changing the file permissions to
SYSTEM & Administrators - Full Control
[your username] - Modify & as Owner
Note:
- I'm still using Windows 10 built-in SSH client
C:\Windows\System32\OpenSSH\ssh.exe
& not using cygwin at all
Solution 4
For those still struggling with this, check this out: https://github.com/PowerShell/openssh-portable/pull/418. This was the case for me. It turns out that your computer should be named differently from your username... 🤷♂️ It will probably be fixed soon in future updates, because fix got into commit.
So again: if your computer name is the same as your username and you still haven't fixed this issue with permissions dialog, then probably renaming your computer could help.
Solution 5
I'm not sure what version of Windows you're running, but since this is recent I'd guess Windows 10. I recently found out that an OpenSSH client is installed by default as of the April 2018 update. I then found I had two instances of OpenSSH: the one I installed myself and the one Windows gave me. Uninstalling the one I had installed caused the error message you describe.
The solution that worked for me was to remove the user-installed OpenSSH as well as the C:\Users\username\.ssh
folder, and let Windows 10 OpenSSH create the folder when you run the command the next time. I didn't have any configuration I was worried about losing, but if you do I'd suggest copying and pasting the contents of the files somewhere and recovering them afterwards.
Hope this helps!

gary69
Updated on July 05, 2022Comments
-
gary69 5 months
I've installed openssh for windows and when I run
ssh localhost
I getBad 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
andchown gary C:\Users\gary\.ssh\config
. I've also cleared the ACL by runningsetfacl -b C:\Users\gary\.ssh\config
and thenchmod 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
-
arberg over 4 yearsAbove worked for me, but didn't work if I replaced by username with OWNER in permission line where Fery has given it Modify permissions. Full control works for permissions.
-
neilsimp1 over 4 yearsThis worked for me (OpenSSH-Win32 on Windows 10) after removing inheritance and all other permissions and adding only myself with Full Control.
-
Raúl Salinas-Monteagudo over 3 yearsChecking the permissions given by the ssh.exe itself after removing the .ssh folder, and applying those to the rest of files, fixed the problem for me.
-
Siraj Alam over 3 yearsIt would be better if you've also told the steps.
-
weeix over 3 yearsThanks for the hint. I solved the issue by adding C:\Program Files\Git\usr\bin to the system variable Path and made sure that it is above (before) %SYSTEMROOT%\System32\OpenSSH. Sadly, I'm unable to use Git's ssh with Windows's ssh-agent service. I'll decrypt all my private keys then.
-
SomeGuyOnAComputer over 3 yearsI had to clone the repo, cd into
/openssh-portable/contrib/win32/openssh
and then run the above command. Much easier than configuring windows file properties and permissions. -
vintprox about 3 yearsGiving full control over file to user and/or removing inheritance doesn't help. Guess I'll just change SSH client, since I have Git Bash installed :)
-
thomthom almost 3 yearsThis appear to have been the case for me. I'd set up another User Account on the system for testing. And it had access. Once I removed that user from access to the
.ssh
folder it worked fine. -
Muhammad Dyas Yaskur almost 3 yearsWhile this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes
-
philistyne almost 3 yearsJust commenting to SEO this answer a bit more as it was hard to find. We were on Composer for Windows 10, version 1.9.3. This answer solved the issue of "UNPROTECTED PRIVATE KEY FILE" and " Bad owner or permissions" when trying update from our own private BitBucket repository.
-
Christophe Hubert over 2 yearsPlease focus on answering the question without adding subjective description
-
Tin Nguyen over 2 yearsThank you so much. This fixed it for me
-
Jamaxack over 2 yearsExectly. My User name and Computer name was the same. Renaming to different names fixed the issue. Thanks
-
Derek Evermore over 2 yearsThis worked for me. I am still running Win 10 1703 and am using a manually installed version of Win32-OpenSSH.
-
Grigory Kislin over 2 yearsYes!! It work also under Windows 10 (done via Git Bush)
-
Liga about 2 yearsThank you, this solved it for me! The issue is still not fixed, I had to change my computer name.
-
phydeauxman almost 2 yearsI tried this but it did not solve the problem for me
-
Rohit Salecha almost 2 yearsBig thanks ! This worked for me. So below was my environment and hope someone finds this useful. - WSL 1.0 running Ubuntu 20 on a Windows 10 machine - .ssh/config file was not being read by vagrant and constantly gave permission issues. - applied the above settings and vagrant ssh worked just fine post application
-
Andy Castles almost 2 yearsThis was the solution which I ended up using. The computer had the same name as the user and this meant that I didn't need to change it.
-
pabouk - Ukraine stay strong almost 2 yearsWhen you are disabling the inheritance you will be asked if you want to copy the current inherited access rights. Select yes and then continue by removing the other user as described above.
-
Harry over 1 yearI solved this by using GitBash instead of Cygwin.
-
Efren over 1 yearDetail update 2021. Still need to remove inheritance. Use: owner -> Full control. Administrator -> Modify. Delete any other. Note that if you open the file it may alter permissions again, depending on the software you use.
-
Simon Müller over 1 yearThis helped me. Thanks. The local Administrator was in this folder for some reason.
-
Yukihiko Shinoda over 1 yearSteps: [File] -> [Preferences] -> [Settings] -> Search
remote.ssh.path
-> InputC:\Program Files\Git\usr\bin\ssh.exe
into [Remote.SSH: Path] see: code.visualstudio.com/docs/remote/… -
Polla A. Fattah over 1 yearHow this is not marked as accepted as clearly this is solving the problem. at least it should popup as the first answer as this is the most valid one.
-
ko80 over 1 yearThank you so much! I had the user name equal to the computer name. Renaming the computer fixed the issue.
-
stackers over 1 year"You don't need to change your permissions whatsoever, just go change the permissions"
-
Rohit Kaushal about 1 yearI had this problem I had copy pasted my old
.ssh
folder after reinstalling windows, thats why it was showing me this error. deleting.ssh
folder and let ssh create it again worked for me. -
mdisibio about 1 yearIT support logged into my machine as Admin and provoked this issue and this was the fix. Error came up when trying to use VSCode to ssh into remote server.
-
doghousedean 11 monthsHow do I buy you a coffee/tea/beer? This has saved me from typing in a huge password every time my VPN drops! Other solutions out there that involve moving the id_rsa file around did not work for me
-
anion 11 monthsThis answer may solve the issue for some users but this is not really the solution of the problem. This is more like a workaround for people who have installed git anyway.
-
andreyk2 Hohlov 9 monthsThanks a lot! This worked for me. BWT, after I disabled INHERITANCE, and issue have fixed, I enabled in back, and all is woking.
-
R Ben R 7 monthsNot enough upvotes, I guess the terminal is a bit too scary, but this really is the better way. I will just add the known_hosts file should remain writable. ` icacls .ssh/known_hosts /grant:rw <username>:f /inheritance:r `
-
Lisa 7 monthsThis worked for me per @YukihikoShinoda but very irritating to not understand for be able to fix the original issue.
-
yodalr 7 monthsyes thank you, this combined with @ala-eddine-jebali answer did the trick for me
-
Tom Malaher 5 monthsI had done this (remove inheritance, remove other users) to the .ssh directory, but the config file itself still had some other users listed. After removing those users, all is working.