cygwin

chmod cannot change group permission on Cygwin


I am using Cygwin and trying to change the group access permission with chmod, e.g.

$ls -l id_rsa
-rwxrwxr-- 1 None 1679 Jun 13 10:16 id_rsa 

$ chmod g= id_rsa 

$ ls -l id_rsa 
-rwxrwxr-- 1 None 1679 Jun 13 10:16 id_rsa 

But this does not work. I can change permission for user and others. Seems that the permission level for group somehow keeps the same as that of user?


Solution

  • I was having a similar problem to you, and I was using the NTFS filesystem, so Keith Thompson's answer didn't solve it for me.

    I changed the file's group owner to the Users group:

    chown :Users filename
    

    After doing that I was able to change the group permissions to my will using chmod. In my case, since it was an RSA key for OpenSSH, I did:

    chmod 700 filename
    

    And it worked. In Cygwin you get two groups by default, the Root group and the Users group. I wanted to add another group, but I wasn't able to do it with the tools I'm used to use on Linux. For that reason I just used the Users group.