Unable to set permissions using Cygwin on Windows 7

3

I have Cygwin 1.7.34(0.285/5/3) installed on a 64-bit Windows 7 machine and I've found that I'm unable to control the permissions of files/directories on my computer with it (through chmod). Most files/folders appear to have permissions fixed at -rw-r--r--.

This is a problem for me as incorrect permissions of the ~/.ssh directory on my workstation might be what's ultimately causing a related issue I have with establishing password-less ssh connections with a server.

This is what my ~/.ssh permissions look like currently:

$ ls -la .ssh/
total 30
drwxr-xr-x 1 davidfallah Domain Users    0 Mar 19 08:21 .
drwxr-xr-x 1 davidfallah Domain Users    0 Mar 18 15:17 ..
-rw-r--r-- 1 davidfallah Domain Users  405 Mar 18 17:26 authorized_keys
-rw-r--r-- 1 davidfallah Domain Users 1675 Mar 18 18:00 gitolite-admin
-rw-r--r-- 1 davidfallah Domain Users  405 Mar 18 18:00 gitolite-admin.pub
-rw-r--r-- 1 davidfallah Domain Users  672 Mar 18 17:27 id_dsa
-rw-r--r-- 1 davidfallah Domain Users  613 Mar 18 17:27 id_dsa.pub
-rw-r--r-- 1 davidfallah Domain Users 1675 Mar 18 17:26 id_rsa
-rw-r--r-- 1 davidfallah Domain Users  405 Mar 18 17:26 id_rsa.pub
-rw-r--r-- 1 davidfallah Domain Users  512 Mar 18 16:16 known_hosts

Based on similar questions I've looked at, I tried running chown -v :Users .ssh/* in case that did anything, and I get the following:

$ chown -v :Users .ssh/*
changed ownership of ‘.ssh/authorized_keys’ from davidfallah:Domain Users to :Users
changed ownership of ‘.ssh/gitolite-admin’ from davidfallah:Domain Users to :Users
changed ownership of ‘.ssh/gitolite-admin.pub’ from davidfallah:Domain Users to :Users
changed ownership of ‘.ssh/id_dsa’ from davidfallah:Domain Users to :Users
changed ownership of ‘.ssh/id_dsa.pub’ from davidfallah:Domain Users to :Users
changed ownership of ‘.ssh/id_rsa’ from davidfallah:Domain Users to :Users
changed ownership of ‘.ssh/id_rsa.pub’ from davidfallah:Domain Users to :Users
changed ownership of ‘.ssh/known_hosts’ from davidfallah:Domain Users to :Users

However, this exact output repeats itself every time, suggesting it's not actually making any changes. Similarly, trying to run chmod -v 777 ssh/* (as an example permission config) consistently produces the following output:

$ chmod -v 777 .ssh/*
mode of ‘.ssh/authorized_keys’ changed from 0644 (rw-r--r--) to 0777 (rwxrwxrwx)
mode of ‘.ssh/gitolite-admin’ changed from 0644 (rw-r--r--) to 0777 (rwxrwxrwx)
mode of ‘.ssh/gitolite-admin.pub’ changed from 0644 (rw-r--r--) to 0777 (rwxrwxrwx)
mode of ‘.ssh/id_dsa’ changed from 0644 (rw-r--r--) to 0777 (rwxrwxrwx)
mode of ‘.ssh/id_dsa.pub’ changed from 0644 (rw-r--r--) to 0777 (rwxrwxrwx)
mode of ‘.ssh/id_rsa’ changed from 0644 (rw-r--r--) to 0777 (rwxrwxrwx)
mode of ‘.ssh/id_rsa.pub’ changed from 0644 (rw-r--r--) to 0777 (rwxrwxrwx)
mode of ‘.ssh/known_hosts’ changed from 0644 (rw-r--r--) to 0777 (rwxrwxrwx)

This behaviour is the same whether or not I run the Cygwin64 terminal as a regular user or as an administrator.

If it's relevant, my /etc/fstab file is:

# For a description of the file format, see the Users Guide
# http://cygwin.com/cygwin-ug-net/using.html#mount-table

# This is default anyway:
none /cygdrive cygdrive binary,noacl,posix=0,user 0 0

I also get the following information from df -T:

$ df -T
Filesystem     Type 1K-blocks      Used Available Use% Mounted on
C:             ntfs 488282108 184977440 303304668  38% /cygdrive/c
D:             ntfs 488383484   7224840 481158644   2% /cygdrive/d
E:             ntfs 488374972 115013864 373361108  24% /cygdrive/e
U:             ntfs 102403916  94741644    946740 100% /cygdrive/u
W:             ntfs 585869308 187598724 398270584  33% /cygdrive/w
X:             ntfs  29604476  16650464  12954012  57% /cygdrive/x

Tagc

Posted 2015-03-20T08:19:22.113

Reputation: 194

1

The Cygwin mailing list has a solution to a possibly related problem: https://www.cygwin.com/ml/cygwin/2015-05/msg00035.html

– ShadSterling – 2015-07-26T16:29:47.410

Have you tested ssh connections again after executing the chown command which you say doesn't seem to change anything (because it produces the same output if you run the same command again)? It may be that the permissions have in fact changed, but chown isn't telling you that the permissions are already set to what you're "changing" them to.

Also, what about changing windows file/folder permissions for the relevant files? Maybe those permissions preclude chown changes? – r_alex_hall – 2016-01-01T20:53:31.083

No answers