How to CHMOD Future Directories? NEED HELP PLEASE :(

Discussion in 'Site & Server Administration' started by DjChugg, Dec 21, 2010.

  1. #1
    Hey Guys, I need your help.

    I have a cache directory on in my websites root and the script automatically creates folders in their with cache files.

    Is there a way to CHMOD 777 all the new folders created in that directory in advance so that every new folder that is created by the script is already 777?

    Thanks so much
     
    DjChugg, Dec 21, 2010 IP
  2. aassociatehit

    aassociatehit Well-Known Member

    Messages:
    1,778
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    140
    #2
    if you need setup it for a particular folder, than u can setup cronjobs for it to run after certain period of time
     
    aassociatehit, Dec 21, 2010 IP
  3. DjChugg

    DjChugg Active Member

    Messages:
    362
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    85
    #3
    no, thats not what it is. it needs to be 777 permissions at creation of the folder
     
    DjChugg, Dec 21, 2010 IP
  4. st1905

    st1905 Well-Known Member

    Messages:
    573
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    135
    #4
    Hello there,

    If you chmod 777 folders, your server can be hacked real soon. Use suphp or chown the directory (top level directory) to the apache user, on centos its nobody, on debian or ubuntu its www-data, i highly recommend not to chmod 777. If you dont use suphp, php scripts will run as apache user and if you use suphp php will run under your account user.
     
    st1905, Dec 21, 2010 IP
  5. zacharooni

    zacharooni Well-Known Member

    Messages:
    346
    Likes Received:
    20
    Best Answers:
    4
    Trophy Points:
    120
    #5
    Why not set your cache directory to a directory outside of your DocumentRoot, e.g. /home/user/tmp_cache/, then chmod it 1777 ? [Reference]
     
    zacharooni, Dec 22, 2010 IP
  6. naskin

    naskin Peon

    Messages:
    31
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    I think, cronjob its best way.
     
    naskin, Dec 24, 2010 IP