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 .*?


./.* 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 ".[!.]*")
  • 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 ..? – Dmitry Minkovsky Nov 28 '12 at 17:44
  • It appears superuser.com/questions/90837/… addresses my question. – Dmitry Minkovsky Nov 28 '12 at 17:47
  • Thanks Nicole. Those are nice, and I also like cd ..; chmod -R [MODE] /directory – Dmitry Minkovsky Nov 28 '12 at 17:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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