1

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?

1 Answers1

1

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
  • 1
    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