Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2000
    Location
    Calcutta, India
    Posts
    143

    Modifying file permission usinga PHP script

    Hi,

    We are writing a script. This script will need to write to a flat text file. Now, we ar facing a small problem, where i am stuck.

    How do i ensure the security of the file and make it modifyable using this script. To write to a flat text file, we possibly need chmod 666. Now if i do that, i possibly make that file insecure.

    What i have in mind:

    When the edit is required, i chmod the file to 666 and save the file using the PHP script (the script will run under the account of the user whose account contains the files). Once the file is saved, we get back to the old chmod setting.

    How is this possible in PHP. Can someone guide me please.

    This script will NOT run from dedicated server. It will have to work from a shared hosting account without intervention fromthe root system admin.

    Thankx for your help.

    Regards
    Abhishek
    Submit2Please.com - Submit your site to 500+ SEO friendly directories
    EasySiteEdit.com - Point. Click. Edit. Works with existing site.

  2. #2
    Join Date
    Oct 2001
    Location
    Ann Arbor, MI U.S.A.
    Posts
    217
    The best scenerio would be to use the php cgi (if available) in a suexec type confiruation. That way your script runs as you as opposed to as the web server user.

    Chris
    Chris Wells [clwells - at - nexcess.net]
    Nexcess - Beyond Hosting
    Dearborn, MI DC ● Southfield, MI DC
    Wordpress Hosting, Magento Hosting & More!

  3. #3
    Join Date
    Apr 2001
    Location
    Depok, Indonesia
    Posts
    988

    Re: Modifying file permission usinga PHP script

    Originally posted by talash


    What i have in mind:

    When the edit is required, i chmod the file to 666 and save the file using the PHP script (the script will run under the account of the user whose account contains the files). Once the file is saved, we get back to the old chmod setting.
    Not possible unless you are using suexec wrapped PHP under CGI mode. PHP under apache module runs under Apache uid. And it is not possible for apache uid to chmod a file belongs to other user.

  4. #4
    Join Date
    Sep 2000
    Location
    Calcutta, India
    Posts
    143
    Hi,

    The problem is that weneed a generic solution which is universally applicable. Since we planto sell this script. Allsystem admins are not interested in setting the server config for one site

    Abhishek
    Submit2Please.com - Submit your site to 500+ SEO friendly directories
    EasySiteEdit.com - Point. Click. Edit. Works with existing site.

Posting Permissions

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