Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question
add comment

2 Answers

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

ps: i think this is a bug on Windows 8

share|improve this answer
    
The accepted answer didn't work for me, but this did. Thanks! –  Achal Dave Sep 12 '13 at 3:54
    
Also, this is quite a weird bug. On my computer (W8.1), editing the .ssh/config file in Vim always leads to this bug. It's extremely annoying, as every change to my ssh config requires running these commands. –  Achal Dave Oct 22 '13 at 18:14
2  
And just to add to the weirdness, if you're using an non English version of Windows then make sure to use the locale translation of "users" when issuing this command. For example in Dutch it becomes "chown -R :Gebruikers .ssh" –  Alexander Kellett Jan 13 at 10:27
    
For me, this worked: chown -R m0j0:Users .ssh && chmod -R go-rwx .ssh –  m0j0 Jan 23 at 14:40
    
Tried changing the group on just .ssh/config, but it didn't work until I first changed the group on the .ssh directory itself. Thanks! –  Paul Brannan Mar 27 at 16:20
show 1 more comment
up vote 4 down vote accepted

Check the permissions of the config file using Cygwin's ls command:

> c:\cygwin\bin\ls.exe -la c:\cygwin\home\[USERNAME]\.ssh

It will probably be something like this:

total 5
drwxrwxrwt+ 1 Administrators None  0 Oct 20 17:02 .
drwxr-xr-x+ 1 [USERNAME]     None  0 Oct 19 08:15 ..
-rw-------  1 Administrators None 57 Oct 20 16:58 config

The config file needs to belong to [USERNAME]. Try this:

> c:\cygwin\bin\chown.exe [USERNAME] c:\cygwin\home\[USERNAME]\.ssh\config

ls -la should now show the correct owner. If that still doesn't work, try resetting the mode (permissions):

> c:\cygwin\bin\chmod.exe 700 c:\cygwin\home\[USERNAME]\.ssh\config
share|improve this answer
1  
Great answer. Seems it is very particular about the combination, I gave it greater access than that and it wasn't working. –  Matthew Read Sep 20 '12 at 17:42
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.