Windows – “Bad owner or permissions” error using Cygwin’s ssh.exe

cygwin;sshwindows

I'm trying to use ssh.exe in Cygwin (in Windows 7). I copied a config file into c:\cygwin\home\[USERNAME]\.ssh. When I run ssh (for example, ssh -vT git@bitbucket.org) I get the following error:

OpenSSH_5.9p1, OpenSSL 0.9.8r 8 Feb 2011
Bad owner or permissions on /home/[USERNAME]/.ssh/config

How do I get ssh to read my configuration file?

Best Answer

After doing as above, I always got this:

total 22
drwxrwxr-x+ 1 jl None    0 Sep  9 18:44 .
drwxrwxr-x+ 1 jl None    0 Sep  9 18:44 ..
-rw-rw----  1 jl None  129 Jul  1 14:30 config

and the error on .ssh/config. So I've run chown on the .ssh folder, and chmod again like this:

> chown -R [USERNAME]:users .ssh/

and then:

> chmod -R 600 .ssh/

and finally I got it working:

total 29
drwxrwxr-x+ 1 jl None     0 Sep  9 18:44 .
drwxrwxrwt+ 1 jl None     0 Sep  9 18:44 ..
drw-------+ 1 jl Users    0 Sep  9 18:44 .ssh

Edit(for bash on Windows10)

When you get the error..

Failed to add the host to the list of known hosts (/PATH_TO_HOME/USERNAME/.ssh/known_hosts).

Make sure that known_hosts is writable

$ chmod 755 known_hosts

Note: I believe you only need to set 600 for your private key

Then, try to ssh.

When you get..

Permanently added 'HOST_IP' (RSA) to the list of known hosts.

You may replace mode 600

$ chmod 600 known_hosts

P.S.: I think this is a bug on Windows 8.