chown -R user:user .* changes permissions backwards: is this the correct behaviour?

Remember that the command line is expanded (interpreted) by the shell before being executed

sudo chown -R luca:luca /myfolder/.*

is interpreted first as :

sudo chown -R luca:luca /myfolder/.  /myfolder/.. /myfolder/.adobe  /myfolder/.bash_history

note the /myfolder/.. in your command line

chown -R luca:luca /myfolder/.. is equivalent to chown -R luca:luca /
that makes the chown running "backwards"

Use echo /myfolder/.* when you use "*" to verify .


Well. Command line as root is very powerful. Read some of these classics. And yes, .* matching to .. is exactly what is intended. Dot is not a special character. It is a convention. By convention, files that start with a dot are hidden from the default view when listing a directory -- nothing less, and nothing more. By convention, the inode leading to the current directory gets the . name and the inode leading to the parent directory gets the .. name.

What you should have done was

chown -R luca:luca /myfolder

Did I mention that there is nothing special about the file names that start with a dot? Recursive chown doesn't think so.

Right now, you might be able to rescue some of the functionality by changing the ownership back to root. In the long run, you will probably have to reinstall the system, though.

As a general rule:

  1. Avoid working as root.
  2. If you work as root, read each command twice before hitting Enter.
  3. If you are unsure about expansion, try it first with a "safe" command (like echo .*).
  4. Do not work as root.
  5. There are many tasks that can be performed safely using a graphical interface (your problem is an example of such a task).
  6. Did I mention that you should avoid using the root account?