Fixing file and directory permission.
Fixing file and directory permission.
find /home/*/public_html/* -type f -exec chmod 644 {} \;
find /home/*/public_html/* -type d -exec chmod 755 {} \;
we can specify user by replace * with usename
To fix the permission for all the websites.
for i in `ls /var/cpanel/users` ; do chown -R $i.$i /home/$i/public_html/* ; done
for folder only to be 700 + sub dir
find . -type d -exec chmod 0755 {} \;
for file only to be 600 + sub dir
find . -type f -exec chmod 0644 {} \;
find /home/*/public_html -type d -exec chmod 0755 {} \;
find /home/?/public_html -type d -perm 777 -print -exec chmod 755 {} \;
find /home/*/public_html -type f -perm 777 -print -exec chmod 644 {} \;
find /home/*/public_html/wp-content/uploads -exec chmod 777 -R {} \;
or use this technique:
find /home/*/public_html -type d -perm 777 > badpermlist
find /home/*/public_html -type d -perm 777 > badpermlist
for each in `cat badpermlist`
do
chmod 755 $each
done
# This script makes the user's files in public_html to have
# permissions 644 so that they are viewable by browser.
USER=`whoami`
PUB_DIR=/users/$USER/public_html
TMP=/tmp/publish.$$
ls $PUB_DIR > $TMP
sync
sleep 1
while read fname
do
if [ -f "$PUB_DIR/$fname" ]
then
chmod 644 "$PUB_DIR/$fname"
fi
done < $TMP
rm $TMP
exit 0
Comments
Post a Comment