Re: No way to use ssh ~/.ssh/config with "noacl" option
- Date: Sat, 4 Nov 2017 11:30:02 -0400
- From: "Matt D." <codespunk@xxxxxxxxx>
- Subject: Re: No way to use ssh ~/.ssh/config with "noacl" option
On 11/4/2017 9:31 AM, Matt D. wrote:
On 11/4/2017 7:47 AM, Matt D. wrote:
On 11/4/2017 7:37 AM, Corinna Vinschen wrote:
On Nov 4 05:47, Matt D. wrote:
I mount with "noacl" as I don't need ACLs for my purposes and prefer to
leave everything up to Windows permissions.
The problem with this is that ssh insists that ~/.ssh/config be less
permissive. But this file is bound to --rw-r--r-- for this option.
Would it be appropriate to request ssh to ignore this requirement when
"noacl" present on the mounted volume?
Yes, in theory. However, this shouldn't be necessary.
Ssh already has code to check extrem perms only in "acl" mounted
directories, but it does not have this extra check for config files,
basically because it was never necessary:
If you use noacl, your file perms are faked to always be 644, or
444 if the DOS R/O bit is set, or 755/555 if executable/directory.
Additionally all files are faked as if they are owned by your own
Ssh checks the config file like this:
if (((sb.st_uid != 0 && sb.st_uid != getuid()) ||
(sb.st_mode & 022) != 0))
fatal("Bad owner or permissions on %s", filename);
Which means, 0644 permissions are perfectly fine. As are 755 perms
for the ~/.ssh and ~ dirs.
I just mounted my home dir "noacl". The perms are as expected:
$ ls -ld . .ssh .ssh/config .ssh/id_local
drwxr-xr-x 1 corinna vinschen 0 Nov 4 12:27 .
drwxr-xr-x 1 corinna vinschen 0 Mar 14 2017 .ssh
-rw-r--r-- 1 corinna vinschen 703 Jan 19 2017 .ssh/config
-rw-r--r-- 1 corinna vinschen 7329 Jan 12 2017 .ssh/id_local
Note especially the too open perms in case of the private keyfile
"id_local". Still, I can ssh into one of my other machines just fine.
How come this doesn't work for you?
I don't know why it doesn't work for me other than the reported error. I
am trying to use ssh combined with git. My .ssh permissions are:
$ls -ld . .ssh .ssh/config .ssh/github
drwxr-xr-x 1 Matthew D'Onofrio None 0 Nov 4 06:42 .
drwxr-xr-x 1 Matthew D'Onofrio None 0 Nov 4 04:51 .ssh
-rw-r--r-- 1 Matthew D'Onofrio None 80 Nov 4 04:51 .ssh/config
-rw-r--r-- 1 Matthew D'Onofrio None 3243 Nov 3 10:53 .ssh/github
I removed the noacl option in fstab, re-ran Cygwin setup, set
.ssh/config to 600 and ssh was happy. I then reverted back to noacl and
the problem returned.
I'm in the process of trying to build openssh with cygpath for debugging
but this is my first time building anything from Cygwin or using
cygports so it's taking some time.
Please stand by. Looking into this further.
The code "sb.st_mode & 022" will always be true unless the group and
other bits are set to 0. So 755, 644, 555, or whatever would not work.
I made a test build which output the value of sb.st_mode and it
displayed as "100770". This value reflected the actual NTFS ACLs and not
what was displayed at the bash prompt or by "stat -c %a" (which says 644).
This makes sense because Cygwin is pulling the NTFS permissions as there
are no Cygwin ACLs defined.
The only workaround is to use Window's Security diaglog to disable
inherited permissions and remove the Users group. This does seem to
I suppose the argument now is whether this behavior should change in the
face of a drive mounted with "noacl". It took a bit of guesswork as
neither chmod or setfacl was changing the NTFS permissions.
Interestingly, a config file that I chmodded when the drive was mounted
with Cygwin ACLs still works with ssh even though "noacl" is now defined
and it is still part of the HOSTNAME\Users group. Neither stat or
getfacl show these permissions but they can be seen in the security tab
of the file properties. I'm guessing that it works because it has
HOSTNAME\None below HOSTNAME\<my account> or something?
Problem reports: http://cygwin.com/problems.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple