Changing ownership / group Using recursive command

Paul Howarth paul at city-fan.org
Fri Feb 18 19:33:03 UTC 2005


On Fri, 2005-02-18 at 14:25 -0500, Tim Holmes wrote: 
> Hi Folks:  
> 
> I know that this is a kinda basic question, but I don't want to totally
> mess up my webserver.  I have moved some directories to our new
> webserver, and because of the move, they have all been flagged as owned
> by and in the root group.  I want to change this to tholmes owner, and
> apache group.
> 
> I am familiar with the chown and chgrp commands, my question pertains to
> using the recursive flag and the proper syntax for it.  For example the
> directory /var/www/html/mcaschool/ contains our schools website -- every
> file within that website should have a owner of tholmes and group of
> apache.
> 
> As I understand it, I would issue the following commands from the
> /var/www/html/mcaschool/ directory:
> chown tholmes /var/www/html/mcaschool/* -R
> chgrp apache /var/www/html/mcaschool/* -R
> 
> Is this correct, or what is the correct command sequence.  I think I
> have found the right commands, but I don't dare try it till I am sure as
> I cannot afford to screw up the entire site.

# chown -R tholmes:apache /var/www/html/mcaschool

should do the lot all in one go; this will set ownership of the
directory /var/www/html/mcaschool itself too. If that's not what you
want, use /var/www/html/mcaschool/* as in your original thoughts, which
will do all the files and directories inside /var/www/html/mcaschool
(excluding any starting with "." in directory /var/www/html/mcaschool),
but not the directory /var/www/html/mcaschool itself.

Paul.
-- 
Paul Howarth <paul at city-fan.org>




More information about the fedora-list mailing list