I couldn't log in to my "admin" account and Alt+Ctrl+F1 showed all my files were owned by my "standard" user. Odd.
So I carefully changed to /home/admin
and did a
sudo chown -R admin:admin *
(and .*
too).
Great.
Then I couldn't log in as my "standard" user and it turns out that all the files in /home/standard
were now owned by "admin".
Pretty humorous. Why is this happening?
sudo chown -R standard:standard /home/standard/*
did the same thing, changed /home/admin
as well as /home/standard
.
I'm more confused than usual because I tried to upgrade to 15.04 and that pretty much wrecked my computer so I'm putting things back with 14.04, please be patient with me.
Best Answer
This issue is caused because you have run:
We know that
.
indicates the current directory and..
indicates the parent directory. When you run the command with.*
, it simply means that match any hidden file in the current directory (stating with.
), the current directory itself (.
), the parent directory (..
). Simply put anything after.
(*
means 0 or more characters). As a result the parent directory along with all of it child directories getchown
-ed toadmin:admin
.Look at this test:
To revert back you need to
chown
the affected directories again.I am not really sure what your plan was, but here are some ideas:
To
chown
any directory recursively (including hidden files):To
chown
only the files (including hidden files) inside that directory (not the directory itself):To
chown
only the non-hidden files (without the directory itself):