views:

2542

answers:

3

I am using Cygwin with a dll version of 1.5.19 (yes, out-of-date, I know, but we're doing it for configuration control reasons). All my files (existing and newly created) show up with permissions 644, despite a umask of 022. Also, using chmod doesn't change the permissions. I have ntsec set in the CYGWIN environment variable. I need to be able to add execute permissions; is there anything I can try to fix this or is it a lost cause?


A much later note: I realized that a key part of the problem is that the files I was trying to chmod were in a ClearCase dynamic view, which uses MVFS. I still have not found way to successfully set the execute permissions, though.

+1  A: 

You need /etc/passwd and /etc/group files for permissions to work correctly.

See Why doesn't chmod work? in the Cygwin FAQ

and

File Permissions in the Cgywin User's Guide

Ken Gentle
I have both of these files, set up with the SIDs as described in those links. Still no luck.
mbyrne215
Hmmm... works for me. I'm using 1.5.25 and have `ntea` set in CYGWIN (although the latest documentation says that both `ntea` and `ntsec` have been removed.)
Ken Gentle
Is the drive mounted with anything unusual? Like `noacl`?
Ken Gentle
Not that I can tell. All the mount points were created automatically, and they don't list 'noacl' when I list them with 'mount'.
mbyrne215
Ok, dumb question: Is the drive NTFS? Last thing to suggest: use "mount --system --binary "C:" /c" and try it. I've got all my local drives and common network shares mounted explicitly. Shouldn't make a difference, but...
Ken Gentle
A: 

A lot of my files show up with permission 000, despite a umask of 0022.

$ ls -l
total 0
d---------+ 15 User None 0 Oct 29 15:59 blog
d---------+ 17 User None 0 Nov 24 22:08 trunk

Even though I have a correctly set up passwd and group file:

$ mkpasswd -l | diff - /etc/passwd

$ mkgroup -l | diff - /etc/group
0a1
> root:S-1-5-32-544:0:

And my windows permissions look ok:

$ cscript e:\cygwin\\bin\\xcacls.vbs trunk
**************************************************************************
Directory: D:\.projects\sulli.cz\s9y\trunk

Permissions:
Type     Username                Permissions           Inheritance           

Allowed  BUILTIN\Administrators  Full Control          This Folder, Subfolde 
Allowed  BUILTIN\Users           Read and Execute      This Folder, Subfolde 

No Auditing set

Owner: HOSTNAME\User
**************************************************************************

And of course, the User account is a member of the Users group:

$ groups User
None Administrators Debugger Users

Is this a bug in cygwin, or some problem with the configuration?

Kim Sullivan
A: 

Edit /etc/passwd to change the default value for GID for your user to 545 (i.e. NT 'Users' group) instead of 513 ('None' group).

Review system-wide /etc/bash.bashrc, $HOME/.bashrc and .bash_profile for default umask settings.

Even if default, do try to set CYGWIN variable in NT system environment to "binmode ntsec".

Let me know if problems disappear.

Ciao

related questions