Is there any way to apply appropriate permissions recursively? Can it be done with chmod?
May 3, 2004 12:42 PM
I backed up my /library/webserver/documents folder to a firewire HD. When I dragged it back, the permissions went all kablooey:
drwxr-xr-x 36 root admin 1224 16 Jan 16:58 Documents
sudo chmod 755 Documents does not give groups write privileges.
1. Do I just need to go read a good chmod tutorial, or is something aberrant happening here?
2. Is there any way to apply appropriate permissions recursively?
Many thanks.
More info: permissions on user accounts are goofy too, so that users can't upload to their (OS X) sites directories or sub directories, and I am trying to avoid having to manually reset them all.
drwxr-xr-x 36 root admin 1224 16 Jan 16:58 Documents
sudo chmod 755 Documents does not give groups write privileges.
1. Do I just need to go read a good chmod tutorial, or is something aberrant happening here?
2. Is there any way to apply appropriate permissions recursively?
Many thanks.
More info: permissions on user accounts are goofy too, so that users can't upload to their (OS X) sites directories or sub directories, and I am trying to avoid having to manually reset them all.
Instead of doing the slightly goofy octal math for permissions, you can also do chmod g+w to add write permissions for group. It basically works like [ugoa][+-][rwx], where u: user, g: group, o: others/world; + adds, - removes permission; r is for reading, w is for writing, and x is for executable. You can also stack things like doing chmod ug+rw to add write and read permissions for both user and group.
posted by zsazsa at 1:06 PM on May 3, 2004
posted by zsazsa at 1:06 PM on May 3, 2004
If you want the group to have 'w' permission, you're looking for chmod -R 775
Think of each digit as a column:
posted by majick at 1:07 PM on May 3, 2004
Think of each digit as a column:
Owner Group Everyone-else 1 r r r 5 rw rw rw 7 rwx rwx rwxThen pick the numbers you want for each column.
posted by majick at 1:07 PM on May 3, 2004
argh.
"5" should be rx across there and "1" should say "4". Sorry. I got caught up making the pretty chart.
posted by majick at 1:09 PM on May 3, 2004
"5" should be rx across there and "1" should say "4". Sorry. I got caught up making the pretty chart.
Owner Group Everyone-else 4 r r r 5 rx rx rx 7 rwx rwx rwx
posted by majick at 1:09 PM on May 3, 2004
!!
This thread goes into my permanent bookmarks. Thanks so much, it worked great! You should all be technical writers. No, wait--you deserve more money than that.
posted by mecran01 at 1:22 PM on May 3, 2004
This thread goes into my permanent bookmarks. Thanks so much, it worked great! You should all be technical writers. No, wait--you deserve more money than that.
posted by mecran01 at 1:22 PM on May 3, 2004
To add one detail to zsazsa's post, you can also use = as the operator to set the permissions equal to whatever you want. Ex/ chmod u=rwx,og=rx foo/
posted by thebabelfish at 1:59 PM on May 3, 2004
posted by thebabelfish at 1:59 PM on May 3, 2004
To add another, you can use g+X instead of g+x to add execute permission for groups only to directories and to files that have the user- or other-execute bit set, rather than unnecessarily to all your documents. When I want to recursively set 775 I do
chmod -R a+rX,ug+w,o-w dirname
posted by nicwolff at 2:23 PM on May 3, 2004
chmod -R a+rX,ug+w,o-w dirname
posted by nicwolff at 2:23 PM on May 3, 2004
This thread is closed to new comments.
If you want to recursively apply permissions, use the -R flag.
chmod -R 755
chown works with the same flag: chown -R user:group
posted by n9 at 12:53 PM on May 3, 2004