views:

33

answers:

2

Hi there,

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 uploading 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?

A: 

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.

djna
Because on most shared hostings a web-server being run under nobody user, not actual user account.
Col. Shrapnel
+1  A: 

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.

Raymond Tau
it refuses to upload even if i use 0755 as file permission. why is it happening like that? how do i specify that i am the user?
Ibrahim Azhar Armar
@Ibrahim that's easy. just buy another hosting account. Which runs dedicated Apache under your user, not common one. Needless to say that such proper hosting would be way more secure than your current one
Col. Shrapnel
@Ibrahim, What's the error message when it "refuse to upload"? Can you produce a directory listing including the directory and the files within? Then, you should be able to see the directory and file permissions in that directory. Also, do you know which user is used to run your application?
Raymond Tau