[K12OSN] Script to flush down the drain files from every user home...
Peter Scheie
peter at scheie.homedns.org
Fri Jun 20 13:23:29 UTC 2008
Well, I'll start the discussion and let others refine it:
#!/bin/bash
for line in $(cat /etc/passwd)
do
user=$(echo $line | cut -d":" -f1)
uid=$(echo $line | cut -d":" -f3)
homedir=$(echo $line | cut -d":" -f6)
if [ $uid -ge 500 ]; then
echo "Deleting files for user $user"
rm -rf $homedir/.g*
rm -rf $homedir/.mozilla
rm -rf $homedir/.cxoffice
fi
done
##### End of script #####
This is just off the top of my head; it may have some egregious errors. It tries
to only delete files in actual users' homedirs by only acting against those UIDs
that are greater than 500, thereby missing the various system IDs. Test it
first on an inconsequential system, let others point out its flaws, YMMV, etc.
Peter
Jim Christiansen wrote:
> Hi guys, Thanks the thoughts. On the upgrade/wipe-install question.
> Today I backed up the group, shadow, password bla bla bla bla bla files,
> unplugged the back-up rsync drive and did a full wipe then new k12el5
> install. Put back the vital parts of the necessary conf files, altered
> the network settings in the template ltsp dir for my different network
> subnet, did the k12 initialize, plugged in the second drive, mounted it
> then rsynced back to the users homes and perms of the users...
>
> Everything is good to go for the fall start of school! Now for the
> other two boxes!
>
> OK so. what I need to do is to drop into EVERY users' home and remove a
> set of files...
>
> I've search high and low, through the lists going back 3 years or so and
> can't find reference to any script that did this. I think there was one
> that several contributed to that we used to trash the dot mozilla, .g*
> files, and I used it also for getting rid of the dot cxoffice folders.
> I'm not great at shell scripts.
>
> Anyone have one? Thanks, Jim :-)
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> K12OSN mailing list
> K12OSN at redhat.com
> https://www.redhat.com/mailman/listinfo/k12osn
> For more info see <http://www.k12os.org>
More information about the K12OSN
mailing list