LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 07-12-2012, 12:54 PM   #1
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442

Rep: Reputation: 76
How do you change permissions for a whole directory tree (subtree)?


Hi:
How do you change permissions for a whole directory tree (subtree)?
 
Old 07-12-2012, 12:59 PM   #2
273
LQ Addict
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 7,680

Rep: Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373
You just add "-R", so
Code:
chmod -R a+r directory
for example.
 
Old 07-12-2012, 01:00 PM   #3
Kustom42
Senior Member
 
Registered: Mar 2012
Distribution: Red Hat
Posts: 1,604

Rep: Reputation: 415Reputation: 415Reputation: 415Reputation: 415Reputation: 415
stf92, I assume you are looking at the chmod or chown commands.

The best place to check for any of these quick questions is the man page. Do a man chmod or man chown and find your answer. You can also look at online manual page sites(I usually prefer this so I dont have to lose my bash prompt to a man page) like ss64.com/bash/.

I know the answer, but since this is an easy one I'm going with the teach a man to fish analogy. If you are looking for something beyond this re-post with some more detail and we can help you out.

---------- Post added 07-12-12 at 11:01 AM ----------

Aww 273 you ruined my post! I was going to make him find it himself...
 
Old 07-12-2012, 01:08 PM   #4
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442

Original Poster
Rep: Reputation: 76
Quote:
Originally Posted by 273 View Post
You just add "-R", so
Code:
chmod -R a+r directory
for example.
Fine, 273. Helpful answer.
@Kustom42: and is it not to help linux beginners what this forum is aall about?
 
Old 07-12-2012, 01:48 PM   #5
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,617

Rep: Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963
Quote:
Originally Posted by stf92 View Post
Fine, 273. Helpful answer.
@Kustom42: and is it not to help linux beginners what this forum is aall about?
In this case, both stf92 and kustom42 are right. A quick answer to a quick question is great. But, you've been registered here since 2007...that is, FIVE YEARS. Hardly a beginner, and have certainly used Linux long enough to know about man pages.
 
Old 07-12-2012, 03:23 PM   #6
Kustom42
Senior Member
 
Registered: Mar 2012
Distribution: Red Hat
Posts: 1,604

Rep: Reputation: 415Reputation: 415Reputation: 415Reputation: 415Reputation: 415
I was trying to get you to do a man page search for your answer.

Code:
man chmod
/recursive #Being a search for the word recursive
Just for your info in case you didn't know how.


But yes, stf the point is to help people with Linux. I like empowering people to find the answers themselves if possible, it usually makes them feel better about it. Wasn't trying to do anything else but help

Last edited by Kustom42; 07-12-2012 at 03:25 PM.
 
Old 07-12-2012, 03:34 PM   #7
273
LQ Addict
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 7,680

Rep: Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373
Sorry Kustom42, you were quite right to point him to the man page. stf92, you should check out the man page for every command you use as a matter of course -- even if you don't want to learn Linux it's still helpful to know you're getting the most from it and you're not missing anything.
 
Old 07-12-2012, 05:51 PM   #8
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442

Original Poster
Rep: Reputation: 76
This calls for an answer. Once I downloaded, in an internet cafe where I stayed all nigth to do it, a linux to boot within MS-DOS. And, without having recourse to internet, I managed to make it boot from the BIOS. I considered it a little feat. And of course I had no remedy but to read man pages (and the infos that I disliked). And I still do so. There is a moderator here who believes I do not. He's wrong. If I post a little too much may be LQ is to blame, for it has made me a bit of a lazy boy.
 
Old 07-12-2012, 11:50 PM   #9
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
Also, technical Linux questions belong in the main Linux forums rather than General, so I've reported this for moving there.
 
Old 07-13-2012, 01:24 PM   #10
Mr. Alex
Senior Member
 
Registered: May 2010
Distribution: No more Linux. Done with it.
Posts: 1,238

Rep: Reputation: Disabled
Code:
find directory/ -type f -exec chmod 644 {} \;
find directory/ -type d -exec chmod 755 {} \;
So you won't end up having executable files along with executable dirs or non-executable files with non-executable dirs.
 
Old 07-13-2012, 03:08 PM   #11
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442

Original Poster
Rep: Reputation: 76
It's kind of you, Mr. Alex. Should a directory be executable or non executable? Or depends on its contents?

Last edited by stf92; 07-13-2012 at 03:11 PM.
 
Old 07-13-2012, 03:44 PM   #12
Kustom42
Senior Member
 
Registered: Mar 2012
Distribution: Red Hat
Posts: 1,604

Rep: Reputation: 415Reputation: 415Reputation: 415Reputation: 415Reputation: 415
Directory needs to be executable for you to be able to create or write any files to the directory.
 
Old 07-13-2012, 05:54 PM   #13
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442

Original Poster
Rep: Reputation: 76
Thanks a lot and a good week-end.
 
Old 07-14-2012, 04:04 AM   #14
Mr. Alex
Senior Member
 
Registered: May 2010
Distribution: No more Linux. Done with it.
Posts: 1,238

Rep: Reputation: Disabled
Quote:
Originally Posted by Kustom42 View Post
Directory needs to be executable for you to be able to create or write any files to the directory.
To be completely pedantic,
  • "r" allows to read (see) the contents of a dir
  • "x" allows to actually `cd` into dir and get access to contents
  • "w" allows to change contents of a dir - create/delete/modify files and subdirs
This is not as obvious as with permissions for files.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to change the permissions the whole directory? pratikvimal Linux - Newbie 10 06-12-2009 10:13 AM
Change file extentions in a directory tree threelions66 Linux - Newbie 2 11-27-2006 09:22 PM
permissions for directory tree adamwenner Linux - Security 3 10-23-2004 07:39 AM
can't change directory permissions walterbyrd Debian 7 07-24-2004 01:20 PM
How do I Change directory permissions? Stevetgn Linux - Newbie 8 06-09-2004 12:09 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 11:16 PM.

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