Webserver permission denied error


 
Thread Tools Search this Thread
# 1  
Webserver permission denied error

Hello,

I was trying a perl-cgi tutorial and saving the data from online form to a file named (guests.txt). I am using the localhost port 80 for practice.
My page file "guestbook.html" is working as I saw the online form. After filled out the blanks and submit, I was expecting to see the result saved in the guest.txt file, but there was an error:
Code:
500 Internal Server Error
 The server encountered an internal error or misconfiguration and was unable to complete your request.

and my log file indicated:
Code:
[Mon May 07 00:18:00 2012] [error] Can't open guests.txt: Permission denied\n

The file was created by the form action---a perl script (located in /usr/lib/cgi-bin/). Now my question is:
1) Where is this guest file should go?
2) The problem seems to be with apache, then how to change the permission to let apache write the data to the designated file?
3) Some posts said it is the configuration of the server, how to I change the configuration?
Quite new on this, gurus please clarify this for me.
Thanks a lot!
# 2  
Let's get some context to start with. From the Webserver (assuming that it is a unix server), please post the output from:
Code:
find // -name 'guests.txt' -follow -exec ls -lad {} \;
find // -name 'guestbook.html' -follow -exec ls -lad {} \;

When you have found the files, please post ls -lad for the parent directory of both files.

Please post the Operating System and version of all computers involved in this problem making it clear which computer is the client and which is the server.

... my log file indicated. What is the exact path and name of the log file and what software wrote this file?
# 3  
RE: webserver permission error

Thanks methyl!
Maybe I should not say it is "webserver" as I am using my laptop@localhost for testing. I am learning by myself while reading some books and websites. The example was copied from the site, where I posted my question for the author too.
Code:
http://www.bin-co.com/perl/tutorial/modules.php

I'm using Ubuntu
Code:
~$> uname -a 
Linux yt-laptop 3.0.0-19-generic #33-Ubuntu SMP Thu Apr 19 19:05:57 UTC 2012 i686 athlon i386 GNU/Linux

~$ sudo ls -lad /var/www/guestbook.html
-rw-r--r-- 1 www-data www-data 4986 May  7 11:02 /var/www/guestbook.html

~$ find -name 'guests.txt' -exec ls -lad {} \;
-rw-r--r-- 1 root root 43 May  7 10:55 ./guests.txt
~$ cat ./guests.txt 
 came from .E-mail address is .Comments : 

~$ tail /var/log/apache2/error.log
[Tue May 08 20:38:55 2012] [notice] Apache/2.2.20 (Ubuntu) PHP/5.3.6-13ubuntu3.7 with Suhosin-Patch mod_perl/2.0.5 Perl/v5.12.4 configured -- resuming normal operations
[Tue May 08 21:05:59 2012] [error] Can't open guests.txt: No such file or directory\n
[Tue May 08 21:09:51 2012] [error] Can't open guests.txt: No such file or directory\n
[Tue May 08 21:09:54 2012] [error] Can't open guests.txt: No such file or directory\n
[Tue May 08 21:09:57 2012] [error] Can't open guests.txt: No such file or directory\n

And the Firefox browser displayed the message as
Code:
Internal Server Error 
The server encountered an internal error or misconfiguration and was unable to complete your request.
 Please contact the server administrator,  webmaster@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.
 More information about this error may be available in the server error log.
  Apache/2.2.20 (Ubuntu) Server at localhost Port 80

It seems my Apache is fine as when I tried other tests (even with connection with MySQL database), not problem. But I can't tell anything else with my Apache. Again I felt the problem is with the communications of "my browser". I start with the question: which folder "guests.txt" should be written in. I assume it is /var/www. Am I right?
Here I attached the two files for my script. guestbook.html was located in /var/www/, and guestbook.pl is located in /usr/lib/cgi-bin/.
Did I miss anything?
Thanks a lot!
# 4  
I'm no Perl programmer but in guestbook.pl the program refers to guests.txt in two places - once with a full hierarchial name and once without. This is probably the error. Both lines have exactly the same error message which makes debugging painful.

The find commands I posted should have output full hierarchial names which would tell us where the file is, but you have chosen to run something different.
 

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Pipe, permission denied error

Hello, I am trying to stream lines written into file. When first source is down, I expect the code to swap to second line and run it. Script below works as usual and it prints out each line of the input file (s.txt): #!/bin/bash while read -r line; do echo "$line" done <"$1" exit 0Output... (12 Replies)
Discussion started by: baris35
12 Replies

2. Red Hat

Permission denied error using chmod on a cifs mount

I have a RHEL 5.7 system with a cifs mount from a Windows 2007 file server that I need to fix the permissions on. Once the share is mounted the permission for the mount are 777. I need to change that to 770 on the top level directory and to 640 on the sub-directory .ssh/. But when I run chmod... (0 Replies)
Discussion started by: westmoreland
0 Replies

3. AIX

SSH Error - Permission denied (publickey,keyboard-interactive)

Hello, I'm trying to setup password less authentication to remote ssh server. I generated the public key and gave it to the vendor and The key is added in the remote machines authorized_keys file. When I try to connect to a remote machine through SFTP username@host I am getting the error... (4 Replies)
Discussion started by: nice_chapp
4 Replies

4. UNIX for Dummies Questions & Answers

Getting Error 0403-006 Execute permission denied.

Hi All, Need your help.. I am writing one script in which I am assigning value to one variable but when i am executing it is showing error "0403-006 Execute permission denied" below is the line of that script : INPUT_COUNT=wc $GIF_DIR/input/VID_RIMS.DAT | awk '{print $1}' and access... (2 Replies)
Discussion started by: NirajThakar
2 Replies

5. Shell Programming and Scripting

Change: xecho: execute permission denied error

Hello, I am have an issues with one of my scripts. I get the following error when I get to the point in the script where I am making the change. The change does take however. the error is "change: xecho: execute permission denied" Everything was working properly until I start cleaning... (3 Replies)
Discussion started by: simpsonjr
3 Replies

6. OS X (Apple)

Permission Denied Error with X11

Hello, I am using Tiger 10.4.11 I am trying out the GIMP, so I installed the X11 package from "Optional Installs" on the cd. Whenever I open X11, I get an error: xterm: could not exec /dev/null: Permission denied I have chmodded /dev/null to 777, as well as the /tmp directory. I deleted... (2 Replies)
Discussion started by: Ricardo-san
2 Replies

7. UNIX for Advanced & Expert Users

Need help with Couldn't canonicalise: Permission denied error

Hi People I am getting this error Couldn't canonicalise: Permission denied. Anyone knows what does this error mean ? It all started when my team members were testing Sftp functions on some directories and they were hitting directory no found errors within their scripts. So when we enquired... (8 Replies)
Discussion started by: wilsontan
8 Replies

8. Shell Programming and Scripting

xterm gives me permission denied error

When I try to run xterm at a command prompt in solaris 2.5.1, i'm getting a permission denied error. But the directory and user permissions look ok, they are part of a users group and then also root,sys,adm so what gives? Any ideas? Thanks! (1 Reply)
Discussion started by: kymberm
1 Replies

9. UNIX for Advanced & Expert Users

getcwd: permission denied error

When I do a 'cd /appl' and issue 'ls -al' command, I get the following error for .. directory. ./..: Permission denied But still I get a listing of other directories under /appl. Also, if I give 'man' for any command under this /appl folder, I get the following error: ... (3 Replies)
Discussion started by: Deepa
3 Replies

10. UNIX for Dummies Questions & Answers

rm Permission Denied error

I am very new to Unix. We have a script that will remove files from a directory. The account removing the files has the same permissions as the directory the files are located. We have logged in as the account and deleted the files from that directory but when we run the script with the account... (7 Replies)
Discussion started by: Cech2002
7 Replies

Featured Tech Videos