chmod questions

Larry Hall (Cygwin) reply-to-list-only-lh@cygwin.com
Wed Aug 7 18:48:00 GMT 2013


On 8/7/2013 2:33 PM, Drew Adams wrote:
> I have read various info regarding trying to make Cygwin's `chmod'
> work as (I) expected, including the Cygwin FAQ and user guide.
> I am using Windows 7 with an NTFS disk.  My user and group are
> defined as they should be AFAIK.
>
> Two questions in this regard:
>
>   . is "chmod a-w" supposed to set the Windows Read-only attribute
>     on Windows 7?

No.

>   . is "chmod a-w" supposed to cause "ls -l" to show -r-r-r on
>     Windows 7?

Not exactly.  More precisely, it will remove the write permissions for
all.

> When I do `chmod a-w' it does not seem to have any effect.  The
> target file is still writable.  Can someone please tell me what
> I'm missing?  Thx.

I'm assuming that you're not using the exact syntax that you have
above.  This works for me:


$ ls -l
total 23302
-rwxr-xr-x  1 lhall None    72393 Jun 17 12:46 a.exe*
-rw-r--r--  1 lhall None       84 Jun 17 12:45 helloworld.c
-rw-r--r--  1 lhall None      587 Jun 17 12:45 helloworld.o

$ attrib
A            C:\tmp\junk\a.exe
A            C:\tmp\junk\helloworld.c
A            C:\tmp\junk\helloworld.o

$ chmod -w *

$ ls -l
total 23302
-r-xr-xr-x  1 lhall None    72393 Jun 17 12:46 a.exe*
-r--r--r--  1 lhall None       84 Jun 17 12:45 helloworld.c
-r--r--r--  1 lhall None      587 Jun 17 12:45 helloworld.o

$ attrib
A            C:\tmp\junk\a.exe
A            C:\tmp\junk\helloworld.c
A            C:\tmp\junk\helloworld.o

Of course, whatever your umask setting is comes into play as well.

-- 
Larry

_____________________________________________________________________

A: Yes.
 > Q: Are you sure?
 >> A: Because it reverses the logical flow of conversation.
 >>> Q: Why is top posting annoying in email?

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list