chmod features: +RW?

Paul Armstrong army at cyber.com.au
Sat Jun 5 04:50:38 GMT 2004


On Thu, Jun 03, 2004 at 05:14:54PM -0500, Dan Rue wrote:
> I am interested in a feature addition to chmod for the equivalent of +X
> (Add x bit only if it's a dir), except for read and write (R and W?).
> 
> I'm not sure how useful W would be - but R would be quite useful for
> allowing the reading and traversing of dirs without giving read
> permission to the contents of the dirs.  

You've got a misunderstanding here.
The reason the +X feature is there is for exactly the prupose you propose
above:

> mkdir -p foo/bar
> ls -al foo
total 6
drwxr-xr-x  3 army  army  512 Jun  4 21:45 .
drwxr-xr-x  3 army  army  512 Jun  4 21:45 ..
drwxr-xr-x  2 army  army  512 Jun  4 21:45 bar
> chmod 111 foo
> ls -al foo
ls: foo: Permission denied
> cd foo
> ls -al .
ls: .: Permission denied
> ls -al bar
total 4
drwxr-xr-x  2 army  army  512 Jun  4 21:45 .
d--x--x--x  3 army  army  512 Jun  4 21:45 ..
> chmod 400 bar
> cd bar
bar: Permission denied.
> ls -al bar
ls: .: Permission denied
ls: ..: Permission denied
> chmod 700 .
> ls -al .
total 6
drwx------  3 army  army  512 Jun  4 21:45 .
drwxr-xr-x  3 army  army  512 Jun  4 21:45 ..
dr--------  2 army  army  512 Jun  4 21:45 bar



More information about the freebsd-hackers mailing list