Fix file permissions

#!/bin/bash
 
for DIR in /media/images /media/videos /media/music; do
    echo ${DIR}
 
    echo "set owner..."
    chown nobody:nogroup ${DIR} -R
 
    echo "set directory permissions..."
    find ${DIR} -type d -exec chmod 777 {} \;
 
    echo "set file permissions..."
    find ${DIR} -type f -exec chmod 666 {} \;
 
    echo "remove lock files..."
    find /media/ -name ".~lock*" -exec rm {} \;
done

Do you like this page? Then support it. Please click the AD below and visit the sponsor. Thank you!