SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot
    Join Date
    Feb 2006
    Posts
    184
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Securely writing to a file/directory.

    I have a new host, and I'm trying to figure out how to get one of my scripts to work securely. Apparently they supposedly allowed you to write to a directory using chmod 755, unfortunately that's not working. Obviously chmod 777 does, but that's insecure.

    I was wondering, what would be the most secure way to handle writing to files? In my script, should I perform a chmod 777 to the file just before writing to it, then chmod 644 when done? Would that be acceptable for security?

    I'm open to opinions.

  2. #2
    SitePoint Evangelist anjanesh's Avatar
    Join Date
    Jun 2004
    Location
    Mumbai
    Posts
    447
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think you will the folder writable - chmod 777 or whatever works.
    But dont worry regarding chmoding 777 to a folder unless you dont want other scripts on your server to write to that directory. No one can write to that directory remotey, unless allow_url_fopen is set to On - which can only be set in php.ini and if your host has it On then switch to another host now !
    Anjanesh


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •