What are the octal permissions of the directories /usr/lib?

Why are 644 and 755 unix permissions ideal for files/directories in public directories?

  • I've been searching around and I still can't figure out why most scripts and developers recommend that the ideal unix permissions for public_html/other public files and folders are ... 644 permissions for files and 755 permissions for folders... The reason why I'm confused that scripts and others recommend this is if you install a script in a shared hosting environment, even if you're using SuPHP or open_basedir or other security practices, someone on that server could still possibly "view" your files which could include database config files and other files that you wouldn't want someone to read/access. It would make sense that files should be 640 and folders 750 so that the world user (and executed processes/scripts PHP, CGI, PERL, SSH etc) can NOT access your files/folders. So why is this not recommended as it seems to be the more secure permission set for files/directories? Is 644 or 755 a security risk?

  • Answer:

    Well for one thing, any file related to a web server needs to be readable by the effective ID of the server process, therefore by definition everything in public_html MUST be world-readable... Otherwise it's not public, is it? Also, if a "bad person" gets access to your server, your database configuration is NOT very important in the grand scheme of things -- your sysadmin will have much more important things to worry about than your database!

dave at Yahoo! Answers Visit the source

Was this solution helpful to you?

Other answers

Normally the files with 0644 and 0755 are those that you extract from the .tar.gz files, so in any case they are already public. For the configuration files or for those with private data, 0600 is recommended instead. Even some applications refuse to work (or even they automatically run chmod on them) when more permissive permissions are granted to configuration files.

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.