TMH
TMH

Reputation: 6246

Setting folder and files permissions

This is a 2 part question.

Recently my site was hacked, and I'm guessing the main way whoever it was who did it was some of my original sites might have had iffy permissions on the files/folders.

So, part 1. What are they best permissions for files and folders? From what I've read 644 for files and 755 for folders seem to be the best.

And part 2. In Linux is there any command I can do in the root directory to loop through all the folders and files in my sites and apply permissions to both files and folders? So I don't have to go through each directory manually applying permissions (I have ssh access)

Upvotes: 0

Views: 62

Answers (1)

Babblo
Babblo

Reputation: 803

Part2:

Folders

find -type d -exec chmod 755 \{\} \;

Files

find -type f -exec chmod 644 \{\} \;

Upvotes: 2

Related Questions