Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm starting with chmod. I've set up a group and gave them permission (777) and every user inside the group is able to do whatever they want inside the directory /www/.

However, I need to change the permissions to anyone else. So I wrote down:

$ chmod -R o-rwx /www/ && chmod -R o+rw /www/some_interesting_dir

Because I wanted only to allow him access to that directory. But he's unable to perform "cd /www/some_interesting_dir", console says permission denied.

What am I doing wrong?

Thank you very much!

share|improve this question
add comment

migrated from stackoverflow.com Nov 16 '10 at 1:17

This question came from our site for professional and enthusiast programmers.

3 Answers

Instead of o+rw you should use o+rwX which will apply the execute permission bit to all directories in the structure too, allowing users to actually access them. (The execute bit is required to cd into or read files from a directory or any subdirectory.)

share|improve this answer
    
+1 I was actually unaware of the +X for recursively specifying directory permissions. –  meagar Nov 15 '10 at 20:09
1  
@meagar: Thanks. +X is actually defined in man chmod as "execute/search only if the file is a directory or already has execute permission for some user." So it may alter the permissions of files too if they are e.g. 700. –  cdhowie Nov 15 '10 at 20:11
add comment

With directories, the executable bit allows you to view the contents of the directory. You need to add 'o+x' for directories:

find -type d -exec chmod o+x "{}" \;

Giving other users +rw permission seems to defeat the purpose; you're giving everybody write permissions to everything in the directory.

share|improve this answer
add comment

A user must have execute access to the directory he's passing through, the result is that while he can see what's in /www/ he still can't do anything to any of the files in there (As they have their own permissions)

Just chmod o+x www

share|improve this answer
    
The guide didn't say so, but it worked! Thank you very much for your fast response! –  Lenders Nov 15 '10 at 20:08
    
We need a way to PM new users to inform them they forgot to mark answered :) Just a general statement... –  J V Nov 15 '10 at 20:14
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.