I can't chmod group permission in cygwin on Windows 8 so that I cant ssh connect to a server using a 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."
我不能在Windows 8的cygwin中使用chmod组权限,这样我就不能使用ssh密钥连接到服务器。Bash提示:“权限0660”/home/KeepZero/。ssh / id_rsa太开放。需要您的私钥文件不能被其他人访问。
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
4 个解决方案
#1
69
Do an ls -al
and you will see that your files does not belong to any Group (none). Just do a chgrp Users *
on your files and you are fine again.
执行ls -al,您将看到您的文件不属于任何组(none)。只要在你的文件上做一个chgrp用户*就可以了。
#2
48
The solution above 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, YMMVcat /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).在/etc/group中查找“用户”组的组ID(或您所在地区的等效组名)。在我的安装中,这是545,YMMV cat /etc/group|白鹭的用户:“会给你正确的路线。”line上的第三个字段是group id (cat /etc/group|白鹭的用户:|cut -f3 -d':只获取id)。
-
Edit your /etc/passwd file. Locate the record for your user. The 4th 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.
编辑/ etc / passwd文件。为您的用户找到记录。第四个字段是用户的“主组”。它被错误地设置为一个不存在的组。将这个数字更改为上面第1步中的数字。保存等密码文件。
-
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 it's permissions as desired.
关闭任何打开的cygwin窗口/终端,然后打开一个新的。创建一个新文件。它应该有一组“用户”,您应该能够根据需要更改它的权限。
#3
1
A possible reason of this problem is, that you have copied your .ssh folder on the actual pc.. create your own folder, then you get the right user group. Don't copy folders.. the are assigned to user groups that don't match.
这个问题的一个可能原因是,您已经在实际的pc上复制了.ssh文件夹。创建自己的文件夹,然后得到正确的用户组。不要复制文件夹. .分配给不匹配的用户组。
#4
0
I had the same problem on Windows Server 2012 R2. After trying to change the owner or group or even the permissions of a file it still showed the original values and ignored my settings. After reading https://cygwin.com/cygwin-ug-net/ntsec.html#ntsec-files
我在Windows Server 2012 R2上遇到了同样的问题。在尝试更改所有者或组甚至文件的权限之后,它仍然显示原始值,并忽略了我的设置。在阅读https://cygwin.com/cygwin-ug-net/ntsec.html ntsec-files
File permissions
文件权限
On NTFS and if the noacl mount option is not specified for a mount point, Cygwin sets file permissions as on POSIX systems.
在NTFS上,如果没有为挂载点指定noacl挂载选项,则Cygwin会将文件权限设置为POSIX系统。
I figured out that the noacl option was set for the mountpoins:
我算出了为mountpoins设置的noacl选项:
$ mount
C:/cygwin/bin on /usr/bin type ntfs (binary,noacl)
C:/cygwin/lib on /usr/lib type ntfs (binary,noacl)
C:/cygwin on / type ntfs (binary,noacl)
C: on /cygdrive/c type ntfs (binary,posix=0,user,noumount,noacl,auto)
So I removed the noacl option from the mountpoints in /etc/fstab and closed all cygwin windows. After reopening the console the permission setting with chown, chgrp and chmod worked as expected.
因此,我从/etc/fstab的挂载点删除了noacl选项,并关闭了所有cygwin窗口。在重新打开控制台之后,chown、chgrp和chmod的权限设置按照预期工作。
#1
69
Do an ls -al
and you will see that your files does not belong to any Group (none). Just do a chgrp Users *
on your files and you are fine again.
执行ls -al,您将看到您的文件不属于任何组(none)。只要在你的文件上做一个chgrp用户*就可以了。
#2
48
The solution above 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, YMMVcat /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).在/etc/group中查找“用户”组的组ID(或您所在地区的等效组名)。在我的安装中,这是545,YMMV cat /etc/group|白鹭的用户:“会给你正确的路线。”line上的第三个字段是group id (cat /etc/group|白鹭的用户:|cut -f3 -d':只获取id)。
-
Edit your /etc/passwd file. Locate the record for your user. The 4th 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.
编辑/ etc / passwd文件。为您的用户找到记录。第四个字段是用户的“主组”。它被错误地设置为一个不存在的组。将这个数字更改为上面第1步中的数字。保存等密码文件。
-
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 it's permissions as desired.
关闭任何打开的cygwin窗口/终端,然后打开一个新的。创建一个新文件。它应该有一组“用户”,您应该能够根据需要更改它的权限。
#3
1
A possible reason of this problem is, that you have copied your .ssh folder on the actual pc.. create your own folder, then you get the right user group. Don't copy folders.. the are assigned to user groups that don't match.
这个问题的一个可能原因是,您已经在实际的pc上复制了.ssh文件夹。创建自己的文件夹,然后得到正确的用户组。不要复制文件夹. .分配给不匹配的用户组。
#4
0
I had the same problem on Windows Server 2012 R2. After trying to change the owner or group or even the permissions of a file it still showed the original values and ignored my settings. After reading https://cygwin.com/cygwin-ug-net/ntsec.html#ntsec-files
我在Windows Server 2012 R2上遇到了同样的问题。在尝试更改所有者或组甚至文件的权限之后,它仍然显示原始值,并忽略了我的设置。在阅读https://cygwin.com/cygwin-ug-net/ntsec.html ntsec-files
File permissions
文件权限
On NTFS and if the noacl mount option is not specified for a mount point, Cygwin sets file permissions as on POSIX systems.
在NTFS上,如果没有为挂载点指定noacl挂载选项,则Cygwin会将文件权限设置为POSIX系统。
I figured out that the noacl option was set for the mountpoins:
我算出了为mountpoins设置的noacl选项:
$ mount
C:/cygwin/bin on /usr/bin type ntfs (binary,noacl)
C:/cygwin/lib on /usr/lib type ntfs (binary,noacl)
C:/cygwin on / type ntfs (binary,noacl)
C: on /cygdrive/c type ntfs (binary,posix=0,user,noumount,noacl,auto)
So I removed the noacl option from the mountpoints in /etc/fstab and closed all cygwin windows. After reopening the console the permission setting with chown, chgrp and chmod worked as expected.
因此,我从/etc/fstab的挂载点删除了noacl选项,并关闭了所有cygwin窗口。在重新打开控制台之后,chown、chgrp和chmod的权限设置按照预期工作。