LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Red Hat (https://www.linuxquestions.org/questions/red-hat-31/)
-   -   chown, chgrp an entire directoy and contents (https://www.linuxquestions.org/questions/red-hat-31/chown-chgrp-an-entire-directoy-and-contents-347763/)

gin1 07-28-2005 02:50 PM

chown, chgrp an entire directoy and contents
 
Is it possible to chown, chgrp and chmod an entire directory and all subdirectories and files in one fell swoop (or three)? If so, please point me to the right man page or "how to."

Matir 07-28-2005 03:11 PM

Code:

chown -R USER:GROUP DIRECTORY
chmod -R PERMS DIRECTORY

2 ;)

david_ross 07-28-2005 03:13 PM

Welcome to LQ.

Just add the "-R" option to your commands. You can chown and chgrp at once with:
chmod -R USER:GROUP /path/to/dir

gin1 07-28-2005 03:32 PM

Thanks a ton! The -R worked just fine.

Matir 07-28-2005 03:43 PM

No problem. Just for future reference, "an entire directory and contents" is generally referred to as "recursive". In cases like this, you can use that and the man pages to avoid having to wait for replies from us.

gin1 07-28-2005 03:47 PM

Thanks for the info. Waiting for answers from you all was quicker than wading through the book I finally located. Some idiot stole my RedHat manual!

Matir 07-28-2005 03:50 PM

LOL. Well, try wading through 'man chown', 'man chmod', etc. :) I'm not criticizing you for coming here, just suggesting that you can save yourself some time in some cases.

steve407 09-03-2013 10:32 AM

Followup Question
 
Quote:

Originally Posted by Matir (Post 1770905)
LOL. Well, try wading through 'man chown', 'man chmod', etc. :) I'm not criticizing you for coming here, just suggesting that you can save yourself some time in some cases.

This (-R option) just does the /path/to/directory but NOT recursive to the root, correct? I RTFM but the discussion in the fine man page of recursive to root had me confused. Thanks in advance.

Steve

vipul_vaidya 09-06-2013 02:48 AM

Yes..
the easiest way is to give * with the command
ex-
#chmod perms *


All times are GMT -5. The time now is 08:32 PM.