[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: HELP! can't become root



On Wednesday 10 October 2007 13:04, Andrew Sackville-West wrote:
> On Tue, Oct 09, 2007 at 05:25:17PM -0700, tom arnall wrote:
> > Well, I got a list of perm's for stuff in /dev (from a sarge system. I'm
> > on etch). There were only two diff's: two sound devices. But there are
> > lots of insane permissions throughout the rest of the system. Is this
> > because when I did 'chmod -R 777 /dev' I also in effect did 'chmod -R 777
> > /dev/hda1'? But when I do 'ls -R /dev/hda1' I get only  '/dev/hda1'. Why
> > the diff' in the scope of the commands? And where do you read about this
> > kind of thing?
>
> well, ls and chmod are different utilities, so the -R could easily have
> different effects despite having apparently the same function.
>
> 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):

amethyst:/tmp# mkdir -p test/1/2/3/4/5/6/7/8/9/0/1/2/3/4
amethyst:/tmp# ls -l test
total 0
drwxr-xr-x 3 root root 72 2007-10-11 12:56 1
amethyst:/tmp# ls -l test
total 0
drwxr-xr-x 3 root root 72 2007-10-11 12:56 1
amethyst:/tmp# ls -ld test
drwxr-xr-x 3 root root 72 2007-10-11 12:57 test
amethyst:/tmp# ls -ld test/
drwxr-xr-x 3 root root 72 2007-10-11 12:57 test/
amethyst:/tmp# ls -ld test/1/
drwxr-xr-x 3 root root 72 2007-10-11 12:56 test/1/
amethyst:/tmp# cd test/1/2/3/4/
amethyst:/tmp/test/1/2/3/4# ls -l
total 0
drwxr-xr-x 3 root root 72 2007-10-11 12:56 5
amethyst:/tmp/test/1/2/3/4# chown -R jw *
amethyst:/tmp/test/1/2/3/4# ls -l
total 0
drwxr-xr-x 3 jw root 72 2007-10-11 12:56 5
amethyst:/tmp/test/1/2/3/4# ls -ld .
drwxr-xr-x 3 root root 72 2007-10-11 12:56 .
amethyst:/tmp/test/1/2/3/4# ls -lA
total 0
drwxr-xr-x 3 jw root 72 2007-10-11 12:56 5
amethyst:/tmp/test/1/2/3/4# ls -la
total 0
drwxr-xr-x 3 root root 72 2007-10-11 12:56 .
drwxr-xr-x 3 root root 72 2007-10-11 12:56 ..
drwxr-xr-x 3 jw   root 72 2007-10-11 12:56 5

amethyst:/tmp/test/1/2/3/4# chown -R fred .*
amethyst:/tmp/test/1/2/3/4# ls -l
total 0
drwxr-xr-x 3 fred root 72 2007-10-11 12:56 5
amethyst:/tmp/test/1/2/3/4# ls -ld .
drwxr-xr-x 3 fred root 72 2007-10-11 12:56 .

The only way for a recursive run to get back up higher in the tree is 
following a symlink (which is certainly a realistic possibility).

	JW



-- 

----------------------
System Administrator - Cedar Creek Software http://www.cedarcreeksoftware.com
http://jwadmin.blogspot.com/



Reply to: