LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-12-2004, 06:50 PM   #1
jdupre
Member
 
Registered: Sep 2003
Distribution: LFS6.1, FC3, RH9
Posts: 36

Rep: Reputation: 15
How to chmod -R on directories only?


Is it possible to chmod a directory and all of the directories in that directory without affecting the mode of the files in those directories???

From what I can tell,

#chmod -R 777 /some/directory

changes the permissions on all of the directories AND the files. I only want to change the permissions on the directories themselves.

- Joe
 
Old 11-12-2004, 06:58 PM   #2
Demonbane
LQ Guru
 
Registered: Aug 2003
Location: Sydney, Australia
Distribution: Gentoo
Posts: 1,796

Rep: Reputation: 47
here's one way of doing it:
Code:
for foo in $(find /some/directory -type d);do chmod 777 $foo;done
 
Old 11-12-2004, 07:42 PM   #3
jdupre
Member
 
Registered: Sep 2003
Distribution: LFS6.1, FC3, RH9
Posts: 36

Original Poster
Rep: Reputation: 15
Wow, that is great. That can be useful for lots of things! Thank you for enlightening me.

- joe
 
Old 11-13-2004, 12:45 AM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
find /some/directory -type d -exec chmod 777 {} \;


No loops - lazy-mods version ;)



Cheers,
Tink
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
CHMOD directories.sub-directories.files zerojosh Linux - Software 2 11-19-2005 04:22 PM
chmod to only change directories lluciano Linux - General 2 08-17-2005 03:14 PM
Using chmod on directories rob19 Linux - Newbie 4 07-10-2004 05:37 AM
chmod directories only vrillusions Linux - General 4 05-21-2003 09:02 PM
Cannot Chmod directories stelmed Slackware 4 05-19-2003 02:30 PM


All times are GMT -5. The time now is 08:16 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration