开发者

file permissions messed the site! what is the best permission? 644? 744?

just messed the websites at host by changing permission settings :( none of sites are w开发者_开发问答orking now!!! it gives

Forbidden

You don't have permission to access / on this server.

error! how can i fix it?! should i make files' permissions as 644?

thanks!!!


I think that 755 should do.

Basically, you shouldn't grant write permissions for any file/directory to anybody but yourself (the owner), except for dirs/files which are explicitly required by a particular website/framework to be writable. A common example would be a directory for uploading avatars by users of a forum application.

What matters is that you most probably need the 5 for others (hence, you might try 705 and it still could work) to grant execute access for foreign users. While it might not make sense to set +x for all your website's files, the directories use the execute right to check whether the user is allowed to enter that directory. If you set the rights of everything (including directories) to 644/744, nobody except the owner will be able to browse the directory structure of particular folders. As the http daemon hardly ever is run as the directory owner's process, it might be the reason why your website stopped working.


To set the minimal permission you can use:

chmod -R o+r ./
find ./ -type d -exec chmod o-r {} \;
find ./ -type d -exec chmod o+x {} \;

The first line sets the permissions of all files in the directory and any file inside it (including those in subdirectories) to allow read by others.

The second one removes the read permission from directories.

The third one adds the execution permission for directories.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜