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 change the the permissions to my key file key.pem in Cygwin 1.7.11. It has the permissions flags: -rw-rw----

chmod -c 600 key.pem

Reports:

mode of 'key.pem' changed from 0660 (rw-rw----) to 0600 (rw-------)

However:

ls -l key.pem 

still reports

key.pem's permission flags are still: -rw-rw----

This reason why I'm asking is that ssh is complaining:

Permissions 0660 for 'key.pem' are too open.

when I try to ssh into my Amazon EC2 instance. Is this an issue with Cygwin & Windows 8 NTFS or am I missing something?

share|improve this question
    
This sounds like a Win8/Cygwin bug. I'd recommend reporting it on the Cygwin mailing list. –  me_and Mar 6 '12 at 10:30
    
It might be related to NTFS... Windows doesn't really use that Linux scheme. Maybe you can try going into the windows permission settings and only give yourself rights... –  sinni800 Mar 7 '12 at 11:11
    
I think this is related to superuser.com/questions/363141/… –  Daniel Stiner Mar 27 '12 at 2:09

3 Answers 3

up vote 67 down vote accepted

I'm using Cygwin in the Win8CP, and I had the same issue; it's definitely a cygwin bug, but there's a workaround.

Try running:

 chgrp -R Users ~/.ssh

The longer explanation is for some reason, cygwin's /etc/passwd / /etc/group generation are putting the user's default/main group as None. You cannot change the permission of None, so the chmod for group has no effect. I didn't try repairing the passwd / group files myself, but I did a chgrp -R Users ~/.ssh (or the group "HomeUsers" On Windows8 pre-release). After that, you can do the chmod 0600 and it'll work as expected. The chgrp to the Users group can be done in whichever other similar cases you find; it even works as expected since cygwin puts users in the Users group as a secondary group (instead of primary, which would be the correct behavior).

share|improve this answer
7  
I needed chgrp -Rv Users ~/.ssh/* chmod -vR 600 ~/.ssh/* –  Tomáš Fejfar Jan 27 '13 at 12:41
    
@TomášFejfar comment above worked for me. Thanks. –  scaraveos Apr 11 '13 at 7:49
    
@TomášFejfar that was very helpful, maybe it should find its way into install scripts or something –  dashesy Jun 1 '13 at 18:11
    
Yes, that would be lovely, but I usually can contribute only to github-based projects. Elsewhere it's too much hustle ;) –  Tomáš Fejfar Jun 2 '13 at 10:31
1  
Note if you have Windows installed in another language Users is not going to work. Use cat /etc/group to check with what you should replace Users. In Dutch for example you would have to replace Users with Gebruikers. –  tscheepers Jan 9 at 16:58

If you have git bash installed run the same command (chmod -c 600 key.pem) with git bash and avoid Cygwin.

share|improve this answer
chgrp -R Users ~/.ssh

chmod 0600 ~/.ssh/config

chmod 0700 ~/.ssh
share|improve this answer

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.