I’m trying to change 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?
Solution:
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 that, for some reason, Cygwin’s /etc/passwd
and /etc/group
generation are putting the user’s default/main group as None
. And 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 do a chgrp -R Users ~/.ssh
(or, if you are on the Windows 8 pre-release, with the group nameHomeUsers
). 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).