Linux - Inherit directory permissions

Hi all!

I forgot how to chmod and chown a directory where all files and subdirectories inherit the permissions of the parent.  I want the Owner to Read, Write, Execute - the user to Read and Execute, and Other to Read, Write, and Execute
LVL 1
themobilemanAsked:
Who is Participating?
 
JaemConnect With a Mentor Commented:
chown is for changing ownership:
chown -R username.groupname dirname
will change recursively (-R) ownership of dirname to user "username" and group "groupname"

chmod is for modifying permissions:
chmod -R u+rwX,g=rX,o+rwX dirname
would change recursively permission for dirname and anything below it to
* owner read write execute (u+rwX)
* group read execute (g=rX)
* other read write execute (o+rwX)

Note that you have to use X instead of x, so that non-executable files do not get the x perm set.
0
 
adudCommented:
try umask...use the following settings :

0 - read, write, and execute
1 - read & write
2 - read & execute
3 read only
4- write and execute
5- write only
6 - execute only
7 - no permissions granted.

h
..
0
 
adudCommented:
try umask...use the following settings :

0 - read, write, and execute
1 - read & write
2 - read & execute
3 read only
4- write and execute
5- write only
6 - execute only
7 - no permissions granted.

h
..
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
themobilemanAuthor Commented:
What about changing the permissions on files within that directory, not just the parent and subdirectories?
0
 
themobilemanAuthor Commented:
Even though it didn't change the permissions of all the files in the directories, it changed the permissions of the directories and subdirectories.
0
 
JaemCommented:
To change the perms of all files in a directory, I would cd into it and do "chmod u+rwX,g=rX,o=rX *". Note that also would affect directories. Hence you would have then to check/modify the perms of the directories. Also in my example, the perms group don't write but others is weird, since other perms are supposed to be more restrictive than group perms.
0
All Courses

From novice to tech pro — start learning today.