0

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!

0

3 Answers 3

3

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.)

2
  • +1 I was actually unaware of the +X for recursively specifying directory permissions.
    – user229044
    Nov 15, 2010 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, 2010 at 20:11
0

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.

0

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

2
  • The guide didn't say so, but it worked! Thank you very much for your fast response!
    – Lenders
    Nov 15, 2010 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, 2010 at 20:14

You must log in to answer this question.