LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices


Reply
  Search this Thread
Old 07-28-2005, 02:50 PM   #1
gin1
LQ Newbie
 
Registered: Jul 2005
Location: Tennessee
Distribution: RedHat 8.0
Posts: 3

Rep: Reputation: 0
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."
 
Old 07-28-2005, 03:11 PM   #2
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
Code:
chown -R USER:GROUP DIRECTORY
chmod -R PERMS DIRECTORY
2
 
Old 07-28-2005, 03:13 PM   #3
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
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
 
Old 07-28-2005, 03:32 PM   #4
gin1
LQ Newbie
 
Registered: Jul 2005
Location: Tennessee
Distribution: RedHat 8.0
Posts: 3

Original Poster
Rep: Reputation: 0
Thanks a ton! The -R worked just fine.
 
Old 07-28-2005, 03:43 PM   #5
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
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.
 
Old 07-28-2005, 03:47 PM   #6
gin1
LQ Newbie
 
Registered: Jul 2005
Location: Tennessee
Distribution: RedHat 8.0
Posts: 3

Original Poster
Rep: Reputation: 0
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!
 
Old 07-28-2005, 03:50 PM   #7
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
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.
 
Old 09-03-2013, 10:32 AM   #8
steve407
LQ Newbie
 
Registered: Aug 2013
Posts: 4

Rep: Reputation: Disabled
Followup Question

Quote:
Originally Posted by Matir View Post
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
 
Old 09-06-2013, 02:48 AM   #9
vipul_vaidya
LQ Newbie
 
Registered: Jul 2013
Location: India
Distribution: CentOS, RHEL
Posts: 13

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


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Using chown, chgrp, chmod on a vfat partition? Rodolfo Medina Linux - General 7 08-17-2005 08:17 AM
chmod ,chown ,chgrp------------ pal Linux - Newbie 1 02-27-2005 02:49 PM
chown, chgrp Help Icarus1701 Linux - Newbie 1 10-25-2004 06:42 PM
Help: Directories magically chgrp and chown by themselves! Blazer79 Mandriva 2 09-07-2004 11:52 AM
problems with chown and chgrp apax Linux - Software 6 11-03-2003 03:44 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat

All times are GMT -5. The time now is 07:55 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration