changing directory permissions recursively

Matthew Seaman m.seaman at infracaninophile.co.uk
Fri Apr 9 02:26:23 PDT 2004


On Fri, Apr 09, 2004 at 02:03:51AM -0700, Cory Petkovsek wrote:
> On Fri, Apr 09, 2004 at 08:47:07AM +0200, Uwe Doering wrote:
> > >cd $topdir
> > >find . -type d | xargs chmod 755
> > 
> > In case (potentially) untrusted users have had write permission in this 
> > directory tree in the past, a safer alternative would be
> > 
> >   find /path/to/tree/root -type d -print0 | xargs -0 chmod 755
> 
> Please explain the "safer" difference in your eyes, Uwe.  Are you thinking the
> admin might have ./ in their path?

But putting a space in a filename, or by several other means, you can
fake the first version of the command into working on directories
outside what was intended.  However the more usual effect is that the
command fails to change the permissions on the whole tree as desired. 

	Cheers,

	Matthew

-- 
Dr Matthew J Seaman MA, D.Phil.                       26 The Paddocks
                                                      Savill Way
PGP: http://www.infracaninophile.co.uk/pgpkey         Marlow
Tel: +44 1628 476614                                  Bucks., SL7 1TH UK
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20040409/8f730d7d/attachment.bin


More information about the freebsd-questions mailing list