sudo chown -R user.group .*
I hit ^C because it was taking too long. And then I realized: .* also
matches .., the parent directory. So the chown process dutifully moved
up to /home and whacked the ownership and permissions of nearly every
other user on the system. I fixed it pretty quickly from looking at
/etc/{passwd,group} and resetting everything from /home.
I've used UNIX and Linux for 15 years, and amazingly this is the first
time I've run into this particular gotcha.
> sudo chown -R user.group .*
> I hit ^C because it was taking too long. And then I realized: .* also
> matches .., the parent directory.
PS: One of the inherent advantages of find(1): ../ is always skipped.
Aha, thanks for sharing your experience.
I think you can use:
chown -R user.group .[!.]*
Yes, that's one of the shells missfeatures that zsh has fixed.
In zsh, the globbing never expands to "." or "..". Even (.|..)
doesn't expand.
In other shells, you have to write it something like:
sudo chown -R user.group .[!.]* ..?*
--
Stéphane
That ommits files named like "..foo", "..."...
Also, it's not been pointed out, but some chown implementations
do follow symlinks (if not those found while traversing the
directories, at least those passed as argument), so if ".foo" is
a symlink to "/", you'll be changing the ownership of every
file. So best is to add the "-P" option.
Another good reason to avoid the recursive options of those
commands and rely on find (or your shell if it supports it) to
do the recursion.
--
Stéphane
Thank you. I'll remember that.