Does .php require write access?

Discussion in 'PHP' started by postcd, Sep 6, 2014.

  1. #1
    on hosting, should have 644 permissions?

    why not 444 (i might be wrong)

    i mean fully removing write access to files..

    like i have wordpress blog, remove all write access to all phps, so no one can write into them?
     
    postcd, Sep 6, 2014 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
  3. postcd

    postcd Well-Known Member

    Messages:
    1,043
    Likes Received:
    9
    Best Answers:
    1
    Trophy Points:
    190
    #3
    thx, anyone else please can answer the question?
     
    postcd, Sep 8, 2014 IP
  4. NetStar

    NetStar Notable Member

    Messages:
    2,471
    Likes Received:
    541
    Best Answers:
    21
    Trophy Points:
    245
    #4
    644 = Owner can write/read. Everyone else can just read.

    444 = Everyone can just read.

    The reason why 644 is common because an owner can simply change the permissions to do whatever anyway.

    If you are on shared hosting and are trying to stop other people on the server from modifying your files and you don't need to modify them via a script chmod 444. It *may* offer slightly better protection. But I'm assuming the attacker isn't using a script that changes the permissions first.

    I'm not a fan of shared hosting. If you can't go dedicated VPS is the next closest thing.
     
    NetStar, Sep 8, 2014 IP
  5. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #5
    It doesn't require write access, but you should be perfectly fine with a 644 setting - it will almost always make your life easier as well, as if you change it to 444, no form of automatic update functions will work properly (as the scripts can't change / update other files). If the hosting you're on is set up correctly you're the only user who should have access to your setup / directory, and changing stuff to 444 from 644 shouldn't make much of a difference, since users getting past other security measures most likely will be able to change it as they please.
    As for unwanted scripts and similar happenings, knowing what you install would be a great first step...
     
    PoPSiCLe, Sep 8, 2014 IP
  6. pmf123

    pmf123 Notable Member

    Messages:
    1,449
    Likes Received:
    81
    Best Answers:
    0
    Trophy Points:
    215
    #6
    its all down to what account is running the PHP thru apache
     
    pmf123, Sep 19, 2014 IP
  7. Vibrantu

    Vibrantu Greenhorn

    Messages:
    11
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    13
    #7
    I don't think .php will require write access, you should run php file using webserver like apache. But if you want to upload file to particular folder using php page you will have to give write permission for uploading content at run time
     
    Vibrantu, Sep 21, 2014 IP