File permission for wordpress

File permissions

chown www-data:www-data  -R * # Let Apache be owner
find . -type d -exec chmod 755 {} \;  # Change directory permissions rwxr-xr-x
find . -type f -exec chmod 644 {} \;  # Change file permissions rw-r--r--



fix permission for home directory public_html for all user


#!/bin/bash
HME=/home
for i in $(ls "$HME");
do
        if [ -d "$HME/$i" ]; then
                echo "$i";
                #chown -R $i "$HME/$i"
                #chgrp -R $i "$HME/$i"
                find "$HME/$i" -type d -not -path "$HME/.ssh" -exec chmod 755 "{}" \;
                find "$HME/$i" -type f -not -path "$HME/.ssh" -exec chmod 644 "{}" \;
        fi
done;


just add directories where you dont want to add premission in -not -path

like I excluded .ssh folder

Comments

Popular posts from this blog

how to install internet download manger in linux

premium url shortener

convert direct traffic to organic