[K12OSN] Linux Directory Permissions -- Help me clean up my mess

John Baillie jbaillie at stmarys-school.org
Thu Jul 21 20:17:44 UTC 2005


On Thu, 2005-07-21 at 15:39, Mark Cockrell wrote:
> Hello all,
>     I accidentally changed the permissions of all the directories in 
> /home to be owned by "root."  can someone tell me how to change the 
> "owner" back to the individual user.  Perhaps a bash script (which I 
> know nothing about) that will scan /home and change the the owner to the 
> name of the directory?  Example:  directory aabrown should be owned by 
> aabrown.  Any help would be appreciated.



Mark,

This is not fancy but it should work. Test it in a test directory first
:-)


#!/bin/bash
                                                                               
for I in `ls /path/to/directory/`
do chown $I.<group_name> $I
                                                                               
done



-- 
John




More information about the K12OSN mailing list