I can't chmod group permission in Cygwin on Windows 8 so that I can't ssh connect to a server using an ssh key.
Bash prompt warning: "Permissions 0660 for '/home/KeepZero/.ssh/id_rsa' are too open. It is required that your private key files are NOT accessible by others."
KeepZero@t400win8 ~ $ ls test KeepZero@t400win8 ~ $ ls -l total 0 -rwxrwx--- 1 KeepZero KeepZero 0 Mar 4 15:07 test KeepZero@t400win8 ~ $ chmod 700 test KeepZero@t400win8 ~ $ ls -l test -rwxrwx--- 1 KeepZero KeepZero 0 Mar 4 15:07 test KeepZero@t400win8 ~ $ chmod 777 test KeepZero@t400win8 ~ $ ls -l test -rwxrwxrwx 1 KeepZero KeepZero 0 Mar 4 15:07 test
The fix was to set the shortcut to "Run as Administrator". If you are using this method to access your Cygwin environment, go to the properties of the shortcut, select the Advanced button to get the options to "Run as Administrator", check the box, click Ok. And off you go!!
chmod is a command in Unix and Unix-like operating systems that are used to change the access permissions of files and directories. The name is an abbreviation of change mode, which does not exist in Windows OS.
Do an ls -al
and you will see that your files do not belong to any group (none).
Just do a chgrp Users *
on your files, and you are fine again.
Roi Danton's solution works, however it does not solve the root cause, and the issue will recur with any user-created file on which you want to change the permissions.
To fix the problem permanently:
Look up the group ID of the "Users" group in /etc/group
(or the equivalent group name for your locale).
In my installation this was 545 (your mileage may vary). cat /etc/group|egrep '^Users:'
will get you the correct line. The third field on the line is the group id. (cat /etc/group|egrep '^Users:'|cut -f3 -d':'
to just get the id).
Edit your /etc/passwd
file. Locate the record for your user. The fourth field is the "primary group" for the user. It is incorrectly set to a non-existent group. Change that number to the number you found in step 1 above. Save the etc
password file.
Close any open Cygwin windows/terminals and then open a new one. Create a new file. It should have a group of "Users", and you should be able to change its permissions as desired.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With