1753530 Members
4998 Online
108795 Solutions
New Discussion юеВ

Check Ownership Change

 
Pattabhi
Frequent Advisor

Check Ownership Change

Hi All,

I know there has been a couple of discussions on changing ownerships of directories, my requirements is quite similar, I have a file server which hosts the home directories of users, the ownerships of these directories seem to change for no reason, it some times changes to root and some time to some other users. there is no particular pattern of change, it is just random.

There are around 80 home directories, some times the ownership of files/folders inside the home directory changes and some time just the ownership of the parent directory.

There data size is around 900 GB, So can some one recommend the most efficient way of doing this?


What i need here is to write a script that will capture any change in ownership of the files and if so revert it back to its original ownership.


The OS is RH AS5
Home directories shared via NFS.
We have made changes in the NFS share such that none other than the hosting server has write or root host privileges on the shared location, but even then this issue re-occurs very often.

While we investigate this problem, i need to get this script so that it notifies me about the changes if not reverting back the ownership.

Please give in your valuable ideas of achieving this in less time so that i can schedule it regularly using cron

2 REPLIES 2
Ollie Rowland
Frequent Advisor

Re: Check Ownership Change

Hi,

You could approach the solution as follows:

for USER in `ls -1 /home`
do
find /home/$USER ! -user $USER -exec chown $USER {} \;
done
Pattabhi
Frequent Advisor

Re: Check Ownership Change

Wow.. The solution was never so simple :-)
I always thought it was something very complex, so dumb of me. Thanks for the reply.