httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marcus Carey <>
Subject Re: [users@httpd] Cannot read or write files using the AliasMatch Directive
Date Mon, 17 Feb 2003 19:15:59 GMT
Zac Stevens wrote:

>Hi Marcus,
>On Mon, Feb 17, 2003 at 12:40:11AM -0800, Marcus Carey wrote:
>>When mapping directories with the AliasMatch directive cgi programs 
>>cannot write or read files.  Using this directive returns a Permission 
>>Denied error.  How do you set the file and directory permissions when 
>>using the AliasMatch Directive?
>I'm not really understanding what you're trying to do here - AliasMatch is
>not used with CGI at all.  Perhaps you are thinking of ScriptAliasMatch ?
>In any event, it would be helpful if you could provide some details about
>what you're trying to achieve, the relevant config so far, and the actual
>messages from your error_log
>The official User-To-User support forum of the Apache HTTP Server Project.
>See <URL:> for more info.
>To unsubscribe, e-mail:
>   "   from the digest:
>For additional commands, e-mail:

    I added the ExeCGI directive the default httpd.conf file to all cgi
    scripts. Then I used the AliasMatch
    directive to remove the "~" from the username in the URL. When using
    the "~" in a URL a cgi application
    can create files for reading and writing.  However if you use
    AliasMatch the application cannot create files
    for read and write access.

    |<Directory /home/*/public_html>
        AllowOverride FileInfo AuthConfig Limit
        Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
        <Limit GET POST OPTIONS>
            Order allow,deny
            Allow from all
        <LimitExcept GET POST OPTIONS>
            Order deny,allow
            Deny from all

    file.cgi creates a file in the user directory and prints out html
       int fd = 0;
       print("Content-Type: text/html\n\n");
       fd = open("/home/user/file", O_RDWR | O_CREAT | O_TRUNC);
       if(fd == -1)
           printf("Could not create file: %d<br>\n",errno);
           printf("strerror says open failed: %s<br>\n",strerror(errno));
           printf("File created<br>\n");

    In the above case, the output is: File created!

    AliasMatch ^/upages/([a-zA-Z0-9]*)/?(.*) /home/$1/public_html/$2

    file.cgi does not create a file in the user directory but prints out
    html content.

    The error log shows the normal request string with the 200 response
    However, using the AliasMatch directive, the output from
    strerror(errno) retuns: Permission Denied.

    Is there a way to use AliasMatch and I/O routines in cgi applications?

    Thank You!




The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message