Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The command

$ chmod -R 700 ./.*

searches and tries to chmod files and directories above the pwd. Why?

Expected results: Consider pwd is /home/user, I would expect the first . in ./.* to be replaced with /home/user. Then I would expect the chmod applies recursively (-R) to all files beginning with a dot (.*) in /home/user, so: $ chmod -R 700 /home/user/.* all together.

I get a slurry of errors like:

chmod: cannot access `./../otheruser/file': Permission denied

Is this happening because .. matches .*?

share|improve this question

./.* also matches ./.., causing chmod -R to try recursing everything in ...


If you only want the dot files and directories in the current directory, try .[!.]*, which matches everything that starts with . and has at least one non-dot character following.

If you want all the dot files anywhere in your current directory tree, you can use find as shown here using $(...) command substitution to paste the output of find back onto the command line as arguments to chmod.

chmod 700 $(find -name ".[!.]*")
share|improve this answer
Thanks. Then, how might I change ownership/permissions on all the files and directories in a homedir recursively, without recursing into ... I mean, /* also matches /... So do you know how can I not pick up ..? – dimadima Nov 28 '12 at 17:44
It appears… addresses my question. – dimadima Nov 28 '12 at 17:47
Thanks Nicole. Those are nice, and I also like cd ..; chmod -R [MODE] /directory – dimadima Nov 28 '12 at 17:57

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.