chmod - umask problems

webfaxe used Ask the Experts™

i've got some problems with i think chmod, umask permissions or something like that. I#m using the following code:

mkdir ("./gal_2", 0703);
mkdir ("./gal_2/thumbs", 0703);
mkdir ("./gal_2/pics", 0703);

so its supposed to look something like
-rwx----wx for the directory ./gal_2 but it doesn't. it looks like -rwx-----x so it creates 701 and not 703.
but the strage thing is that i can list this directory from the web even though the permission doesn't grant reading for others.

what i want to do is to create a directory structure for each gallery. this structure should be created through a webinterface and then i want to upload the pictures into those directories also through a webinterface. but ofcourse i don't want people to browse this structure. so i thought the directories should have 703 and the pics 705 or is this complete bullsh** ???

but i think this should be an easy to solve problem. i just cannot think anymore!! thanx and have a nice day
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

703 has no sens at all. Granting write mode while you can't even read is complete non-sense.

Then as for your problem, yes it's cvompletely useless what you try EXCEPT if you find a way to shell(), exec() , system() or passthru() some chown command...

The reason why is that the mkdir() are performed by the webserver (apache/apache, nobody/nobody), so it has ALWAYS all rights on the directories he creates, AND THEN everybody from the otside world via HTTP may read them. EXCEPT if you ***find a way*** (good luck) to chown() the directories after creation.

just try to make the director with ftp commands and then try to change the permission with the ftp site command.

when u upload it via browser then the owner of ur files becomes the apache user which is default for php and not u as the owner. so try to use ftp commands to have more control over it.

hope this helps u.
your webserver is running by a user (by default nobody). This user can allow all parts of your webserver. The chmod won't solved the problem. You will need to use chown.

Or configure your webserver so you cannot browse a directory

<Directory "/somepath/to/your/root/htdocs">
#    Options Indexes FollowSymLinks Includes
# Remove indexes
    Options FollowSymLinks Includes
    AllowOverride All

    Order allow,deny
    Allow from all

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial