question regarding file permission
i developed the application using WAMP, i think windows assigns 0644 file permission to all directory by default. i am hosting the application on Unix Server which uses cPanel 11, my application has some directories where user(admin) will be up开发者_StackOverflowloading files to it. what file permission should i be giving to that directory? is it safe if i give 0777 to the directory where i will be uploading the file.? and the rest 0644?
The permission required to write to a directory (when you upload new files to a directory) depends on the user:group of the directory and the effective user:group of the process (your application). Simply speaking, if they are the same, 700 should be enough to upload files already, but that will make any other users unable to read or even go to that directory.
Why do you need to give group and world write rights? Your admin user needs to be able to write, but 755 should be enough.
Often one gives 5 permissions to directories because that includes read and execute, and for a directory execute is needed to be able to list the contents of a directory. So I suspect that the subdirs also need 755.
精彩评论