1. You are viewing our forum as a guest. For full access please Register. WindowsBBS.com is completely free, paid for by advertisers and donations.

Perl Scripts can't write to disk - security issue

Discussion in 'General Internet' started by norman_law, 2005/01/17.

Thread Status:
Not open for further replies.
  1. 2005/01/17
    norman_law

    norman_law Inactive Thread Starter

    Joined:
    2005/01/17
    Messages:
    18
    Likes Received:
    0
    This is my first post. I have done a search but can't find the answer ... so here goes.

    I have begun to dable with CGI on my web site and uploaded a Perl script for a guestbook. The script runs OK but at the point that it needs to create a temporary file on the server it errors out with an access denied message. The error is trapped in the script and its the script that is sending the message so I know the script is running. I have contacted my hosting company who have been unable to find the problem (over a week now).

    Whilst waiting I decided to install IIS 5.1 on my WinXPPro PC. This went OK and I then installed Perl and PHP and registered these in IIS. I have created some test scripts in both Perl and PHP and these run fine unless the script needs to write to the disk. I get the same problem as on my web site. When I run my local copy of my site on 'localhost' everything works OK except the guestbook perl script.

    My web site is also hosted on a Windows 2000 server.

    The only way to set permissions on the wwwroot directory is through the 'Web Sharing' tab in the sharing and security options of the directory. This is set as shared with an alias of '/'.

    Anyone know what the problem could be?

    Cheers,
    Norman
     
  2. 2005/01/17
    Newt

    Newt Inactive

    Joined:
    2002/01/07
    Messages:
    10,974
    Likes Received:
    2
    Hi Norman and welcome.

    I don't have a clue but I am moving this thread to a section where it should get more looks by folks who do and changing the title just a bit.
     
    Newt,
    #2

  3. to hide this advert.

  4. 2005/01/18
    norman_law

    norman_law Inactive Thread Starter

    Joined:
    2005/01/17
    Messages:
    18
    Likes Received:
    0
    Thanks Newt. When I did a search for IIS issues it seemed that they were spread over all the forums (fora?) so I wasn't sure which to post in.
     
  5. 2005/01/18
    Newt

    Newt Inactive

    Joined:
    2002/01/07
    Messages:
    10,974
    Likes Received:
    2
    Yup. Some topics can properly fit in one of several sections. I would have left it where it originally was if there had been any responses. I'm really hoping a script person will take a look at it here. Stay with it and we'll get an answer in a bit.
     
    Newt,
    #4
  6. 2005/01/19
    norman_law

    norman_law Inactive Thread Starter

    Joined:
    2005/01/17
    Messages:
    18
    Likes Received:
    0
    Cracked it!

    I have been digging around in IIS with the Microsoft Management module and have found a wizard that alters the 'web user's' security settings. By default the user is set to read only but the wizard allows you to change that to a more suitable setting to allow write access to your site.

    On a server you can change permissions at file and directory level but you can't do this on a PC operating system. The wizard seems to circumvent this restriction. Even setting the wwwroot directory to shared and giving the 'web user' administrative rights didn't acheive what I wanted until I ran the wizard.

    Now just got to get my hosting company to sort their end out. ;)

    Cheers, Norman
     
  7. 2005/01/19
    TonyT

    TonyT SuperGeek Staff

    Joined:
    2002/01/18
    Messages:
    9,072
    Likes Received:
    400
    What is the dir that this temp file is supposed to be created in? What type of a temp file? Flat file? The dir that is being used must be set to R-W-E for the owner of the script. You'd be better off using php-mysql anyway and avoid these issues. The temp file could actually then be a temp table in the sql db.
     
  8. 2005/01/19
    norman_law

    norman_law Inactive Thread Starter

    Joined:
    2005/01/17
    Messages:
    18
    Likes Received:
    0
    Hi Tony

    The script is a simple perl script that adds entrys to the guestbook.html file. The guestbook.html file is in the root directory of the site and the script creates a lock file to stop more than 1 person at a time adding entrys. It then copies the existing guestbook.html to a temp file and modifies it before deleting the original, renaming temp to guestbook.html and deleting the lock file.

    The problem on an XP machine is that you don't have all the security options you have on a server so the Wizard makes it so that the web user account has the required permissions.

    I am just about to set up mysql on the site and will look for a guestbook PHP solution as soon as I can.

    Thanks for the reply, Norman
     
Thread Status:
Not open for further replies.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.