Home > Installer Help > 3008

Remotely setting file permissions on Windows

This document is intended to help people who experience file permission problems when installing Perl CGI scripts onto Windows web servers.

How do I know if I am having a Windows Perl CGI permissions problem?

Note that we are talking about a Windows web server. The type of computer that you have in your home or office is not what is important here.

Your web hosting company should be able to tell you the operating system of your web server.

If you are having a file permission problem, you will see the string "Permission denied" returned in an error message when the CGI script tries to update some file or folder. Any other problem that you see - like a 404 Not Found error or a 500 Internal Server error - is not necessarily related to file permissions.

Techniques for solving permissions problems

Windows file permissions are a problem because there is no standard way for clients to change permissions remotely. On Unix, permissions are handled automatically by setuid solutions, or they are handled by using FTP and sending CHMOD commands, or they are handled by granting shell access to the user. Windows does not support FTP CHMOD and setuid solutions are much rarer there.

Because there is no standard technique for setting permissions, we need to try a variety of non-standard techniques. In some cases you will need to contact your web host directly. And in some cases it will be impossible to set permissions, because the web host will not cooperate.

Here is a description of all permissions solutions and how to test them:

Sample dialogs with tech support


You: I need to make these files and folders writable for my CGI script. I am hosted on your Windows server.

TechSup: Okay go in with FTP and set "chmod 777".

This is very common. TechSup has been trained for Unix and thinks things are same on Windows. How do you convince him that FTP chmod does not work here?

You: As I mentioned, my site is hosted on a Windows server. Only Unix file permissions can be set via FTP, not Windows permissions.

TechSup: No, they can all be set via FTP.

TechSup needs to be shown

You: My FTP client trace log shows:

yu: 220 c152048a Microsoft FTP Service (Version 5.0).
me: USER xx
yu: 331 Password required for xx.
me: PASS yy
yu: 230 User xx logged in.
me: SITE chmod 666 file.txt
yu: 500 'SITE chmod 666 file.txt': command not understood

You: I have now provided you with technical data that demonstrates the problem. Your server is responding to my valid SITE CHMOD command with an error. Please provide counter-data, such as an FTP trace log showing a successful SITE CHMOD on my Windows server, or retract your claim.

Note: you can get this trace information by using the xav.com auto-installer with the "show detailed FTP trace output" option.


You: I need to make these files and folders writable for my CGI script. I am hosted on your Windows server.

TechSup: Okay go in with FTP and set "chmod 777".

TechSup has been trained for Unix and thinks things are same on Windows.

You: As I mentioned, my site is hosted on a Windows server. Only Unix file permissions can be set via FTP, not Windows permissions.

TechSup: Well I guess you cannot set permissions then. For a transfer fee of only $600 we will transfer you to a Unix server. Or you can take your business elsewhere.

TechSup has no tech answers

You: Actually, there are several ways to set file permissions on Windows, but they just cannot be done over FTP. Would you please manually set them for me? I need folder XXX to be writable. I have uploaded a batch file for you which contains the exact "cacls" command that you would need to run. The file is at /web/XXX/setperms.bat.

At this point you might also request that they set up a setuid solution


You: I need to make these files and folders writable for my CGI script. I am hosted on your Windows server.

TechSup: We do not allow writable files and folders on our Windows servers.

You: My CGI scripts cannot function if they are not allowed to save state by saving to a file. You have claimed that Perl CGI is supported on this account. Part of Perl CGI support is the ability to run programs which save state.

You: That is like allowing me to run a Word processing program on my computer, but not allowing me to save files. That would not be "support for Word processing programs".


You: I need to make these files and folders writable for my CGI script. I am hosted on your Windows server.

TechSup: We do not allow that because of security concerns.

TechSup is paranoid about security and does not understand it. Person is probably afraid of change and afraid of being yelled at. Possible responses:

Security/paranoid people are difficult to work with. If they can articulate the exact specific security concern that they have, then usually you can meet them halfway with a solution that fits your data storage needs and fits their security needs. On the other hand, those tech support people who are not able to articulate any specific concern, but who just keep saying "no, security risk", "no, security risk", "no, security risk" cannot be worked with. You may want to hang up, call again, and hope for a more rational person.


You: I need to make these files and folders writable for my CGI script. I am hosted on your Windows server.

TechSup: We only allow writable files within the non-public "data" folder provided with your account.

You: Okay, thanks [See preset data area]


You: I need to make these files and folders writable for my CGI script. I am hosted on your Windows server.

TechSup: Okay, you can set your own file/folder permissions by going to our custom control panel at http://foo.bar/admin/.

You: Okay, thanks [See custom control panel]


You: I need to make these files and folders writable for my CGI script. I am hosted on your Windows server.

TechSup: Okay, you can set your own file/folder permissions by mapping a drive to our server.

You: Okay, thanks [See mapped drive]


    "Remotely setting file permissions on Windows"
    http://www.xav.com/scripts/installer/3008.html