Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 11-12-2004, 05:50 PM   #1
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, 05:58 PM   #2
LQ Guru
Registered: Aug 2003
Location: Sydney, Australia
Distribution: Gentoo
Posts: 1,796

Rep: Reputation: 47
here's one way of doing it:
for foo in $(find /some/directory -type d);do chmod 777 $foo;done
Old 11-12-2004, 06:42 PM   #3
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-12-2004, 11:45 PM   #4
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

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

No loops - lazy-mods version ;)



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

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

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