[CentOS] Re: chown command goof up

Mon Feb 12 21:03:51 UTC 2007
Scott Silva <ssilva at sgvwater.com>

David A. Woyciesjes spake the following on 2/12/2007 12:34 PM:
>     Basically, what I typed was:
> chown -R user2:user2 *
> chown -R user2:user2 .*
> chown -R user2:user2 *.*
> ...all in /home. Duh. I forgot which way recursive went.
> So, I then did:
> chown -R root:root *
> chown -R root:root .*
> chown -R root:root *.*
> ...this time in / to try and f things. Duh again. Other items need to
> have other owners & groups.
> 
>     So, how can I fix this? In MacOSX, there is a utility to fix all
> permissions on the system. Is there a similar item in CentOS?
> 
>     Here's what I originally wanted to do:
> Started with user1. Got everything setup just right. Then created user2.
> I wanted to use all the settings, mail, etc. from user1 for user2. My
> thought was to just copy everything in /home/user1 to /home/user2, then
> use chown on all of the files. This is where I got myself into this
> pickle...
> 
>     Any ideas?
> 
Is this a production machine? You might be damaged beyond a reasonable repair.
It can be done, but will be a lot of work. Any possibility of a backup and
re-install?

I don't know of an easy way to fix this. Root is dangerous!

Each directory in /home needs to be chown'd to the owner. IE..
chown -R user1name:user1group /home/user1. The rest of the structure will be
tough to repair, as many files and directories are owned by other processes.
It will be some work to get everything right. If not a production system, or
just starting out, you could delete users, delete home directories, and redo
users.
If you want users set up a certain way on creation, you put the changes into
/etc/skel and they will get copied to the new users directory and chown'd to
the newuser when accounts are created.

-- 

MailScanner is like deodorant...
You hope everybody uses it, and
you notice quickly if they don't!!!!