Re: Set group seting to multiple files
On Thu, Sep 12, 2002 at 11:28:00AM -0400, Travis Crump wrote:
> martin f krafft wrote:
> >one warning:
> >
> > NEVER, i repeat *N*E*V*E*R* use the -R flag to chmod/chgrp/chown if
> > the final argument is not a directory. for instance
> >
> > chown -R pierre /music/mp3/*
> >
> > will eventually change *your entire filesystem* to be owned by
> > pierre!
> >
>
> Can someone else confirm this because this doesn't make any sense to me
> and I have never encountered it. I just tried a couple of tests trying
> to confirm this and was unable to reproduce it.
I did this once, then panicked and halted the process when I heard
a lot of disk activity. The problem is (I think) that the wildcard
matches the .. file and the process recurses back into the parent
directory, etc.
I'd recommend using find for this sort of thing, as it allows you to
select files and directories with a lot of flexibility, view them
before doing anything, then do the job a file at a time.
$ find /music/mp3 # ... view & check the list of files
$ find /music/mp3 -exec echo chown -R pierre {} \; # ... check commands
$ find /music/mp3 -exec chown -R pierre {} \; # ... do it
This is probably a lot slower than using recurse options in commands,
but I feel it can be safer.
--
Ken Irving <jkirving@mosquitonet.com>
Reply to: