Using OpenTextFile when IUSR doesn't have Write permission

Discussion in 'ASP General' started by Andyza, Sep 30, 2009.

  1. Andyza

    Andyza Guest

    I'm using code similar to the code below to write to a text file on my
    web server (IIS 6 & Win2k3).

    strFileName = Server.Mappath("Test.txt")
    Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
    Set objFile = objFSO.OpenTextFile(strFileName,8,True)
    objFile.WriteLine "Hello World"
    objFile.Close
    Set objFile = nothing
    Set objFSO = nothing

    In order for thsi script to work the Internet Guest account (IUSR)
    needs to have Write permissions. For obvious security reasons we don't
    really want to allow this. Apart form giving IUSR write access, is
    there any other way get the script to be able to write to the text
    file?

    Thanks
    Andyza, Sep 30, 2009
    #1
    1. Advertising

  2. Andyza

    Bob Barrows Guest

    Andyza wrote:
    > I'm using code similar to the code below to write to a text file on my
    > web server (IIS 6 & Win2k3).
    >
    > strFileName = Server.Mappath("Test.txt")
    > Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
    > Set objFile = objFSO.OpenTextFile(strFileName,8,True)
    > objFile.WriteLine "Hello World"
    > objFile.Close
    > Set objFile = nothing
    > Set objFSO = nothing
    >
    > In order for thsi script to work the Internet Guest account (IUSR)
    > needs to have Write permissions. For obvious security reasons we don't
    > really want to allow this. Apart form giving IUSR write access, is
    > there any other way get the script to be able to write to the text
    > file?
    >

    Cause the code to run under a different security context? In IIS, you
    could do this by using impersonation. But the effect would be the same,
    really. If you are doing this in ASP server-side code then the same
    security hole would be opened. All you can really do is mitigate the
    potential damage by only assigning Write permissions for a specific
    folder.
    --
    HTH,
    Bob Barrows
    Bob Barrows, Sep 30, 2009
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. JT

    OpenTextFile and logging

    JT, Dec 23, 2003, in forum: ASP General
    Replies:
    4
    Views:
    179
  2. jwallison

    OpenTextFile just hangs

    jwallison, Feb 26, 2004, in forum: ASP General
    Replies:
    2
    Views:
    188
    jwallison
    Feb 26, 2004
  3. Fie Fie Niles

    FileSystemObject - OpenTextFile stucks

    Fie Fie Niles, Mar 4, 2004, in forum: ASP General
    Replies:
    3
    Views:
    161
    Fie Fie Niles
    Mar 4, 2004
  4. Colin Steadman

    Special Permission for IWAM or IUSR to run VBS File?

    Colin Steadman, Apr 5, 2004, in forum: ASP General
    Replies:
    1
    Views:
    265
    Colin Steadman
    Apr 7, 2004
  5. AVB
    Replies:
    2
    Views:
    202
    Tom Kaminski [MVP]
    Sep 14, 2005
Loading...

Share This Page