This question is a near duplicate of Robert's question but after trying chmod 600 ~/.ssh/config I still have the same error.

I've tried using cygwin and MINGW32 to do the chmod 600. ls -la returns -rw------- on cygwin and returns -rw-r--r-- on MINGW32.

By these results, cygwin says that it does have the proper permissions and therefore shouldn't be complaining when I ssh hostname, however both cygwin and MINGW32 complain when trying to ssh.

This is similar to the issues I had with gitosis where this article said that I needed to switch over the ssh.exe files from cygwin to git (MINGW32) which did actually fix the issue at the time. However, this fix doesn't seem to be working any more as MINGW32 isn't chmoding properly.

Any ideas?

  • 1
    Make sure the permissions are reasonably restrictive on all ancestor directories as well. For example, chmod 700 ~/.ssh and chmod 755 ~. – 200_success Jul 7 '11 at 21:30
  • Also had to chown _UserName_ config. According to cygwin I wasn't the owner of the file, although MINGW32said I was. – user29600 Jul 11 '11 at 19:36

Actually for me none of the above worked.

The inspiration came from http://yifanpeng.blogspot.co.uk/2013/03/cygwin-ssh-tip.html

On linux you would just ensure the owner and group on your .ssh dir is jujhar by executing chown jujhar.jujhar ~/.ssh where ~ is a shortcut for /home/jujhar

The only difference with cygwin on windows is that the jujhar group is not created and you have to use the Users group. Once that is set then you can chmod correctly.

In my case I did the following and it works great

chown jujhar.Users /cygdrive/c/Users/jujhar/.ssh
chmod 0700 /cygdrive/c/Users/jujhar/.ssh
chmod 0600 /cygdrive/c/Users/jujhar/.ssh/*

NB My home directory for my username jujhar is set to /cygdrive/c/Users/jujhar (you can change it in /etc/passwd. This makes backups and stuff easier for me (Crashplan ftw.)

| improve this answer | |

Important note if your Windows is not in US English: the "users" group's name is locale-dependant. If your Windows is in Spanish, you'll have to change the files' ownership with chown $USER:Usuarios *

| improve this answer | |

The issue was not to chmod but chown the file since cygwin said my account wasn't the owner of the file. Confusion was again in that MINGW32 said I was the owner... Wish I had the skills to fix the chmod and chown in their project.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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