[K12OSN] chown script help needed (word of caution)

John Baillie jbaillie at stmarys-school.org
Sun Sep 4 16:38:20 UTC 2005


Peter Hartmann wrote:

>Hey List,
>I'm in sort of a bind and I need someone to help me with a chown
>script.  Because of some craziness with webmin and some idiocy in need
>a script that will do this:  for UID including and over 531 I'd like
>to chown -R users home folders to their own UID:GID.   It looked as if
>webmin would do this for me but unfortunately not.
>
>Thanks so much in advance!
>
>Peter
>
>_______________________________________________
>K12OSN mailing list
>K12OSN at redhat.com
>https://www.redhat.com/mailman/listinfo/k12osn
>For more info see <http://www.k12os.org>
>  
>
Here's a little script that will do the magic.

#!/bin/bash

for i in `ls /home/`;
do
 chown -R $i:$i /home/$i
echo chowning $i to $i

done

Word of caution:

Using the webmin add user bulk script it is possible to name home dirs 
with a space and a slash at the tail

for instance /home/jsmith /

this can distroy your machine by running the reset-all-desktops script

you end up chowning everything under / to jsmith:jsmith











More information about the K12OSN mailing list