Koozali.org: home of the SME Server

Legacy Forums => Experienced User Forum => Topic started by: jumba on April 27, 2005, 03:52:15 PM

Title: Scripties, take a look!
Post by: jumba on April 27, 2005, 03:52:15 PM
A question to the script-gurus out there:

When someone (user with user account on SME server. In this discussion, lets call him "user_a") quits his job, there should be nice to use a bash script to:


* Localize  every file in every IBAY OWNED by "user_a"
* Change the OWNERSHIP on every of those files to "user_b" instead


Taking care of the files in "user_a"'s /home directory is of course no problem, but trying to manually locate and change ownership on several hundreds of files located somewhere in different IBAY's is not an easy task...

I should prefer a script to do the hard job....

.....Anyone?????
Title: Scripties, take a look!
Post by: hmuhammad on April 27, 2005, 04:15:24 PM
from the command line...

find /home/e-smith/files/ibays -type f -user user_a -exec chown user_b {} \;
Title: Thanks a lot!!!!!!!!!!!!!
Post by: jumba on April 27, 2005, 05:45:01 PM
As far as I can see (yes I DID make a few tests...), your suggestion works all rigt!

I found that I (of course!) might need to change the ownerships on directories as well, so there are two useful strings now:

To switch owner of FILES:
find /home/e-smith/files/ibays -type f -user user_a -exec chown user_b {} \;

To switch owner of DIRECTORIES:
find /home/e-smith/files/ibays -type d -user user_a -exec chown user_b {} \;


Please correct me if I'm wrong.