View Full Version : unix permissions questions

12-14-2010, 08:42 PM
You load file A in your browser which causes file A to open and read the data in file B in directory X.

What are the minimum permissions file A needs to have?
What are the minimum permissions file B needs to have?
What are the minimum permissions directory X needs to have?

If you have questions you need answered before answering, please ask. Thanks.

12-15-2010, 01:19 AM
r-x, (5), for directories, r--, (4), for files. As to which, owner, group or other depends on who the user/owner is and who the HTTPD daemon is running as.

12-15-2010, 11:20 PM
Thanks. I am the owner of the files.

Chmod-ing directoryX to dr-xr--r-- makes it inaccessible via the browser.

Chmod-ing it to 445 makes it accessible via the browser. dr--r--r-x

However, I can't edit the file in the directory with my code editor.

Chmod-ing directoryX to 545 allows me to edit fileB.

fileB in directoryX is set to -r-xr--r-- 544

and that enables me to edit it and read from it with the browser. Anything less causes denials.

I didn't specify being able to edit the file, but those seem to be the minimal permissions required for the scenario.

12-15-2010, 11:32 PM
To do the same, but writing instead of reading:

-rw-r--r-- fileC.php

drwxr-xr-x directoryY

-rwxrwxrwx fileD.php (inside directoryY)

12-15-2010, 11:43 PM
You need to understand user, group and other. You also need to know what your web server (apache, lighttpd, iis) is running as. It's often "nobody" in typical apache configurations, which should fall into "other". In this scenario, you could have:

A u r-- g r-- o r--
B u r-- g r-- o r--

But the folder should technically be possible to have as:
X u r-- g r-- o r--

But in reality you'll probably need

X u r-x g r-x o r-x

If the web server is configured with "suPHP" or similar and uid/gid match, you can do:

A u r-- g --- o ---
B u r-- g --- o ---
X u r-x g --- o ---

12-16-2010, 12:08 AM
Have a read of this man page too:


12-16-2010, 10:44 PM
Thanks for everyone's replies.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum