为什么不能在Windows 8 CP的cygwin chmod?

我不能chmod在Windows 8 cygwin组权限,所以我不能SSH连接到服务器使用SSH密钥。
Bash提示警告:“'/home/KeepZero/.ssh/id_rsa'的权限0660太开放了,要求你的私钥文件不能被其他人访问。

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 

做一个ls -al ,你会看到你的文件不属于任何组(无)。 只要做一个chgrp Users *在您的文件,你很好。

上面的解决scheme工作,但它不能解决根本原因,问题将重新发生与您想要更改权限的任何用户创build的文件。 要永久解决问题:

  1. 在/ etc / group中查找“Users”组的组ID(或您的语言环境的等效组名)。
    在我的安装中,这是545,YMMV cat /etc/group|egrep '^Users:'会给你正确的路线。 该行的第三个字段是组ID。 ( cat /etc/group|egrep '^Users:'|cut -f3 -d':'只是得到id)。

  2. 编辑你的/ etc / passwd文件。 find您的用户的logging。 第四个字段是用户的“主要组”。 它被错误地设置为不存在的组。 将该号码更改为您在上述步骤1中find的号码。 保存etc密码文件。

  3. closures任何打开的cygwin窗口/terminal,然后打开一个新的。 创build一个新文件。 它应该有一组“用户”,你应该能够根据需要更改它的权限。

这个问题的一个可能的原因是,你已经复制了你的.ssh文件夹的实际电脑..创build自己的文件夹,然后你得到正确的用户组。 不要复制文件夹..分配给不匹配的用户组。