Koozali.org: home of the SME Server

Scripties, take a look!

Offline jumba

  • *****
  • 291
  • +0/-0
  • Donations: July 2007 - $ 20.00
    • Smeserver på svenska!
Scripties, take a look!
« 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?????

Offline hmuhammad

  • ***
  • 65
  • +0/-0
Scripties, take a look!
« Reply #1 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 {} \;
...............

Offline jumba

  • *****
  • 291
  • +0/-0
  • Donations: July 2007 - $ 20.00
    • Smeserver på svenska!
Thanks a lot!!!!!!!!!!!!!
« Reply #2 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.