Forum Moderators: phranque

Message Too Old, No Replies

chmod 777 on directories... security

how do I protect these folders?

         

pg78

3:31 pm on Nov 21, 2003 (gmt 0)



Hello. I have chmodded a folder to 777 and after reading this post...
[webmasterworld.com...]

I was wondering how I protect the folder from hackers? I see that I am supposed to edit the htaccess file within the directory. However, I have 4 versions of that file...

.htaccess
-htaccess
/htaccess
:htaccess

and a file titled %2fhtaccess

Do I have to edit all of them? And what exactly is the code? I chmodded the directory to allow images to be uploaded using a phpbb.

Thanks.

dingman

6:49 pm on Nov 21, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The only one of those files that matters is '.htaccess'.

As for allowing uploaded files, I've never looked into Apache directives to make that safe. On the rare occasions when I want to let users upload a file, I use a form with a file input. The file gets created in a non-web-accessible directory using a pre-made tempfile creation function to evade most tempfile creation attacks, and then if I need the file to last longer than it takes to process the data inside it I'll have PHP move it. I don't think I'd ever set permissions on *anything* higher than 775. Even that is so permissive it makes me nervous.