user331465
user331465

Reputation: 3094

How/why cygwin breaks windows permissions?

We have complaints "from the field" (i.e. from sysadmins installing software) that cygwin "messes up" windows permissions on NTFS (Windows 7/10/2008/2012, etc).

Problem Usecase

The general usecase is this:

Result: Service fails to start

Workaround Steps

These steps seem to get past the problem:

Result: Windows service starts

Question

thanks in advance

Upvotes: 7

Views: 5708

Answers (2)

user15513573
user15513573

Reputation:

To add to the answer of ulathek here is the copy-paste of the two URLs:

First:

How to fix incorrect Cygwin permission in Windows 7

Cygwin started to behave quite strangely after recent updates. I was not able to edit files in vim, because it was complaining that files are read only. Even cp -r didn’t work correctly. Permission of new directory was broken and I was not able to remove it. Pretty weird behavior.

E.g. ls -l

total 2
----------+ 1 georgik None 34 Jul 14 18:09 index.jade
----------+ 1 georgik None 109 Jul 14 17:40 layout.jade

Hm. It is clear that something is wrong with permission. Even owner has no permission on those files.

Output of mount command:

C: on /cygdrive/c type ntfs (binary,posix=0,user,noumount,auto)

I found a solution at cygwin forum. It’s quite easy to fix it.

Open /etc/fstab and enter following line:

none /cygdrive cygdrive binary,noacl,posix=0,user 0 0

Save it. Close all cygwin terminals and start new terminal.

Output of mount:

C: on /cygdrive/c type ntfs (binary,noacl,posix=0,user,noumount,auto)

Output of ls -l

total 2
-rw-r--r-- 1 georgik None 34 Jul 14 18:09 index.jade
-rw-r--r-- 1 georgik None 109 Jul 14 17:40 layout.jade

Second:

7/14/2010 10:57 AM
> Drive Y is a mapping to a network location. Interestingly, ls -l
>> /cygdrive returns:
>>   d---------+ 1 ????????       ????????     24576 2010-07-09 11:18 c
>>   drwx------+ 1 Administrators Domain Users     0 2010-07-14 06:58 y
>>
>> The c folder looks weird, the y folder looks correct.
>>     
> Try ls -ln /cygdrive.  The user and group ownerships on the root of the
> C: drive are most likely not found in your passwd and group files.  The
> -n option for ls will print the user and group IDs rather than try to
> look up their names.  Unfortunately, I can't think of any way offhand to
> generate the passwd and group entries given only user and group IDs.
> Maybe someone else can comment on that.
>   

I think your answer is correct:
  $ ls -ln /cygdrive
  total 24
  d---------+ 1 4294967295 4294967295 24576 2010-07-09 11:18 c
  drwx------+ 1        544      10513     0 2010-07-14 11:45 y

I edited my /etc/fstab file (it contained only commented lines) and
added this line at the end of the file:
  none /cygdrive cygdrive binary,noacl,posix=0,user 0 0

I closed all my Cygwin processes, opened a new terminal and did an ls-l
on visitor.cpp again:
  -rw-r--r-- 1 cory Domain Users 3236 2010-07-11 22:37 visitor.cpp

Success!!! The permissions are now reported as 644 rather than 000 and I
can edit the file with Cygwin vim and not have bogus read-only issues.
Thank you Jeremy.

cory

Upvotes: 0

ulatekh
ulatekh

Reputation: 1500

I found the answer here; it refers to this mailing-list letter.

You need to edit Cygwin's /etc/fstab and add "noacl" to the list of mount-options.

Upvotes: 6

Related Questions