I have to save a file in the server with a CGI C program and then access it with the client. If I save the file in the cgi-bin directory, it works but I cannot access it with the client because that directory is protected. If I try to save the file in another directory, the fopen function can't create the file.
FILE *fh = fopen (filename, "wb");
Working but file not accessible.
FILE *fh = fopen (//var//www//filename, "wb");
Not working. The directory is writeable, it works if I run the statement on a local C program.
So, how I can give permissions to CGI programs to write in the www directory?
I'm using Ubuntu and apache.
Thank you
FILE *fh = fopen (//var//www//filename, "wb");.You forgot to addFILE *fh = fopen ("//var//www//filename", "wb");maybe that's why, and try to specify the whole path. - bitcellchmod a+rw /var/www? Default permissions for CGI scripts are: 0755 (rwx-rx-rx), whereas you probably want 0766 (rwx-rw-rw) or something - Elias Van Ootegem