On Thursday 11 October 2007 13:04, Jonathan Wilson wrote: > On Wednesday 10 October 2007 13:04, Andrew Sackville-West wrote: > > I seem to recall once I did a chown -R something and it followed the > > /. and /.. links in the directory so that it started walking up the > > directory tree. luckily I stopped it. Perhaps chmod -R is doing a > > similar thing? > > > > A > > That does /not/ happen with any utility's -R. They don't walk up the tree > with ../ , it would be way too dangerous to have any utility work that way. > Think about it. Below are some exampoles using * and even .* to prove it > (it's a little hard to read with line wrapping):
Actually, I was wrong! (partially) and it's somewhat frightening. It does indeed climb up one level - just one, I don't know why. (please note that in my examples I'm using a combination of ls -l and ls -ld ) Running chown -R .* does in fact, change the ownership of just one level up: amethyst:/tmp/test/1/2/3/4# chown -R fred .* amethyst:/tmp/test/1/2/3/4# ls -ld /tmp/test/1/2/ drwxr-xr-x 3 root root 72 2007-10-11 12:56 /tmp/test/1/2/ amethyst:/tmp/test/1/2/3/4# ls -ld /tmp/test/1/2/3/ drwxr-xr-x 3 fred root 72 2007-10-11 12:56 /tmp/test/1/2/3/ amethyst:/tmp/test/1/2/3/4# ls -ld /tmp/test/1/2/3/4/ drwxr-xr-x 3 fred root 72 2007-10-11 13:07 /tmp/test/1/2/3/4/ Or viewed another way: amethyst:/tmp/test/1/2/3/4# ls -ld . drwxr-xr-x 3 jw root 72 2007-10-11 13:07 . amethyst:/tmp/test/1/2/3/4# ls -ld ../ drwxr-xr-x 4 jw root 96 2007-10-11 13:10 ../ amethyst:/tmp/test/1/2/3/4# ls -ld ../../ drwxr-xr-x 3 root root 72 2007-10-11 12:56 ../../ AND, what's really uncomfortable is that it changes the ownership on any other directories that are inside the next folder up: amethyst:/tmp/test/1/2/3/4# chown -R jw .* amethyst:/tmp/test/1/2/3/4# ls -l /tmp/test/1/ total 0 drwxr-xr-x 3 root root 72 2007-10-11 12:56 2 amethyst:/tmp/test/1/2/3/4# ls -l /tmp/test/1/2/ total 0 drwxr-xr-x 4 jw root 96 2007-10-11 13:10 3 amethyst:/tmp/test/1/2/3/4# ls -l /tmp/test/1/2/3/ total 0 drwxr-xr-x 3 jw root 72 2007-10-11 13:07 4 drwxr-xr-x 3 jw root 72 2007-10-11 13:10 sub1 amethyst:/tmp/test/1/2/3/4# ls -l /tmp/test/1/2/3/sub1/ total 0 drwxr-xr-x 3 jw root 72 2007-10-11 13:10 sub2 amethyst:/tmp/test/1/2/3/4# ls -l /tmp/test/1/2/3/sub1/sub2/ total 0 drwxr-xr-x 2 jw root 48 2007-10-11 13:10 sub3 However, this would mean the OP had to do something like: cd /dev ch[mod] -R .* because chown -R * does not climb the tree like .* does. JW -- ---------------------- System Administrator - Cedar Creek Software http://www.cedarcreeksoftware.com http://jwadmin.blogspot.com/ -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]