0

This question already has an answer here:

I noticed the command chown -R user:group * ran as root won't affect dot files like .htaccess, unless I specify them one by one, like chown -R user:group .htaccess

How to make chown -R user:group * effective on dot files too?

marked as duplicate by Stephen Kitt, Jeff Schaller, lgeorget, don_crissti, Anthon Apr 27 '16 at 11:02

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

0

I had to use chown -R user:group .* because the wildcrd in bash does not expand to dot files by default, unless the dot is explicitly specified.

That behavior may be changed with shopt -s dotglob, which sets the option to always includes hidden files when expanding filename patterns (known as "globbing").

  • Or chown -R user:group * .* to match both dot files and non-dot files. – lgeorget Apr 27 '16 at 10:36
  • Careful, that chown doesn't do what you think it does. '.*' also matches '.' and '..', so you're chowning the parent directory itself and everything under it, including the current directory, and all of their subdirectories. If you run it under /home/foo, you'll end up chowning all of /home. – marcan Apr 27 '16 at 10:51

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