What is the best way to secure a folder ?

Discussion in 'Security' started by bub0, Apr 17, 2010.

  1. #1
    Hello,

    I am developing an application where people can upload images and I would like to know how to secure the folder where the images are stored ?

    Is a .htaccess redirection is the best way ? And put a simple blank index.html file inside.

    Thank you
     
    bub0, Apr 17, 2010 IP
  2. SirGod

    SirGod Peon

    Messages:
    11
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Yes, use .htaccess and nobody will be able to access the files inside it via HTTP.
     
    SirGod, Apr 17, 2010 IP
  3. brightyoursite

    brightyoursite Peon

    Messages:
    59
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    make the folder cant writable
     
    brightyoursite, May 3, 2010 IP
  4. SecureCP

    SecureCP Guest

    Messages:
    226
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #4
    What are you protecting against? I like the above answer, make it not writable? so how are users going to upload files to it? Browse through my blog and you can find some htaccess stuff that can protect you from low level threats. Low level is probably what you need to protect yourself from anyways.
     
    SecureCP, May 3, 2010 IP
  5. p.hall

    p.hall Guest

    Messages:
    26
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Also set the names of the files inside to something that can not be easily guessed, like the MD5 sum of the file.
     
    p.hall, May 4, 2010 IP
  6. crashus

    crashus Active Member

    Messages:
    90
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    53
    #6
    use .htpasswd as well so you can secure some folders by password
     
    crashus, May 4, 2010 IP
  7. p.hall

    p.hall Guest

    Messages:
    26
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    He doesn't need to password protect it, as users need to have access there. As I understand, they just shouldn't be able to view the folder contents and guess the file names.
     
    p.hall, May 4, 2010 IP
  8. Actaviosan

    Actaviosan Guest

    Messages:
    216
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #8
    .htaccess should do it.
    But personally? If I were you I'd use .htaccess AND I'll chmod it.
     
    Actaviosan, May 5, 2010 IP
  9. ryan1918

    ryan1918 Active Member

    Messages:
    668
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    60
    #9
    That isn't a true way of securing anything, If someone wants access they will exploit a security hole in the software, or the server itself and that htaccess file will be a useless file on your server.
     
    ryan1918, May 5, 2010 IP
  10. SirGod

    SirGod Peon

    Messages:
    11
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    Oh my god, read what you said and what I said. You can't do anything from your browser if you don't have access to files via another method. Of course if you have root access the htaccess will be useless.
     
    Last edited: May 6, 2010
    SirGod, May 6, 2010 IP
  11. CyberHacK

    CyberHacK Peon

    Messages:
    36
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #11
    use your htaccess.
     
    CyberHacK, May 9, 2010 IP
  12. fanofchopin

    fanofchopin Well-Known Member

    Messages:
    180
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    108
    #12
    I think changing the CHMOD is enough to secure it.
     
    fanofchopin, May 10, 2010 IP
  13. mikeasro

    mikeasro Peon

    Messages:
    145
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #13
    Put it in a filing cabinet and lock the door.
     
    mikeasro, May 13, 2010 IP
  14. phpSiteMinder

    phpSiteMinder Peon

    Messages:
    47
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #14
    You dont really want to secure the folder. You just want to stop people browsing the contents of the folder right?. In that case a blank index.html file will stop the directory listing from being displayed.

    I assume you still need people to be able to connect to the folder via your webpage. If not (for example you are using php to stream the file) then you can use a htaccess file with "deny from all" to prevent any browsers from accessing any of the files inside it.(php could still read and stream the files, since its using the filesystem). And/Or make the uploads path outside of the web root folder.
     
    phpSiteMinder, May 16, 2010 IP
  15. Namjies

    Namjies Peon

    Messages:
    315
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #15
    Is it an image hosting so people can embed elsewhere, or personal image where content is kept for personal use? You might want to leech protect the files so people can't place them on other websites if it's not for hosting images to be posted elsewhere.
     
    Namjies, May 20, 2010 IP
  16. kevoh99

    kevoh99 Peon

    Messages:
    175
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #16
    LOL! You just hit the right way. I like it.
     
    kevoh99, May 25, 2010 IP