Can not write to /usr/local/httpd/htdocs

Can not write to /usr/local/httpd/htdocs

Post by Ilse Kienecke » Sat, 28 Apr 2001 02:23:44



Hi all,
I am running APACHE webserver on SUSE Linux 7.1 and
I am using some CGI/Perl programs doing

          ..........
          open(FH,"> write_me.txt");
          print FH "Hello, world! \n";

          .......

However, whenever I run the program no file is written! In the htttpd
error log file I've got the message:

"Can not open file for writing".

Does anynore know what do I have to do in order to get that thing running?
Has this problem something to do with permissions?

Looking forward to hearing from you soon!

Ilse

--
_____________________________________________________________
NewsGroups Suchen, lesen, schreiben mit http://netnews.web.de

 
 
 

Can not write to /usr/local/httpd/htdocs

Post by Jon_ » Sat, 28 Apr 2001 06:42:33


what are the permision settings for the folder /htdocs ou ma have to chmod
0755 to get it to work. if it is only on our internal network used only by
yourself for testing purposes you can also try 0777 (not recomended for
internet use)
to view the permissions go to directory /usr/local/httpd and use 'ls -l' to
see  the permission settings. Sorry if i am teaching ou to suck eggs.
have a look at this extract from the security HOWTO
http://www.linuxdoc.org/HOWTO/Security-HOWTO.html#toc5

cheers
Jon_H

SUID Attribute: (For Files)
This describes set-user-id permissions on the file. When the set user ID
access mode is set in the owner permissions, and the file is executable,
processes which run it are granted access to system resources based on user
who owns the file, as opposed to the user who created the process. This is
the cause of many "buffer overflow" exploits.

SGID Attribute: (For Files)
If set in the group permissions, this bit controls the "set group id" status
of a file. This behaves the same way as SUID, except the group is affected
instead. The file must be executable for this to have any effect.

SGID Attribute: (For directories)
If you set the SGID bit on a directory (with chmod g+s directory), files
created in that directory will have their group set to the directory's
group.

You - The owner of the file

Group - The group you belong to

Everyone - Anyone on the system that is not the owner or a member of the
group

File Example:

        -rw-r--r--  1 kevin  users         114 Aug 28  1997 .zlogin
        1st bit - directory?             (no)
         2nd bit - read by owner?         (yes, by kevin)
          3rd bit - write by owner?        (yes, by kevin)
           4th bit - execute by owner?      (no)
            5th bit - read by group?         (yes, by users)
             6th bit - write by group?        (no)
              7th bit - execute by group?      (no)
               8th bit - read by everyone?      (yes, by everyone)
                9th bit - write by everyone?     (no)
                 10th bit - execute by everyone?  (no)

The following lines are examples of the minimum sets of permissions that are
required to perform the access described. You may want to give more
permission than what's listed here, but this should describe what these
minimum permissions on files do:

-r--------  Allow read access to the file by owner
--w-------  Allows the owner to modify or delete the file
            (Note that anyone with write permission to the directory
             the file is in can overwrite it and thus delete it)
---x------  The owner can execute this program, but not shell scripts,
             which still need read permission
---s------  Will execute with effective User ID = to owner
--------s-  Will execute with effective Group ID = to group
-rw------T  No update of "last modified time".  Usually used for swap
             files
---t------  No effect.  (formerly sticky bit)

Directory Example:

        drwxr-xr-x  3 kevin  users         512 Sep 19 13:47 .public_html/
        1st bit - directory?             (yes, it contains many files)
         2nd bit - read by owner?         (yes, by kevin)
          3rd bit - write by owner?        (yes, by kevin)
           4th bit - execute by owner?      (yes, by kevin)
            5th bit - read by group?         (yes, by users
             6th bit - write by group?        (no)
              7th bit - execute by group?      (yes, by users)
               8th bit - read by everyone?      (yes, by everyone)
                9th bit - write by everyone?     (no)
                 10th bit - execute by everyone?  (yes, by everyone)

The following lines are examples of the minimum sets of permissions that are
required to perform the access described. You may want to give more
permission than what's listed, but this should describe what these minimum
permissions on directories do:

dr--------  The contents can be listed, but file attributes can't be read
d--x------  The directory can be entered, and used in full execution
             paths
dr-x------  File attributes can be read by owner
d-wx------  Files can be created/deleted, even if the directory
             isn't the current one
d------x-t  Prevents files from deletion by others with write
             access. Used on /tmp
d---s--s--  No effect

System configuration files (usually in /etc) are usually mode 640
(-rw-r-----), and owned by root. Depending on your site's security
requirements, you might adjust this. Never leave any system files writable
by a group or everyone. Some configuration files, including /etc/shadow,
should only be readable by root, and directories in /etc should at least not
be accessible by others.


Quote:> Hi all,
> I am running APACHE webserver on SUSE Linux 7.1 and
> I am using some CGI/Perl programs doing

>           ..........
>           open(FH,"> write_me.txt");
>           print FH "Hello, world! \n";

>           .......

> However, whenever I run the program no file is written! In the htttpd
> error log file I've got the message:

> "Can not open file for writing".

> Does anynore know what do I have to do in order to get that thing running?
> Has this problem something to do with permissions?

> Looking forward to hearing from you soon!

> Ilse

> --
> _____________________________________________________________
> NewsGroups Suchen, lesen, schreiben mit http://netnews.web.de


 
 
 

Can not write to /usr/local/httpd/htdocs

Post by Jeremiah DeWitt Weine » Sat, 28 Apr 2001 07:27:02



>           open(FH,"> write_me.txt");
> Does anynore know what do I have to do in order to get that thing running?
> Has this problem something to do with permissions?

        Possibly.  The directory would have to be writable by the user the
web server is running as.  You might also want to try and get some more
information out of Perl by making it
open(FH, "> write_me.txt") or die "Ack!  Couldn't open write_me : $!";

        which will tell you the particular reason Perl thinks it can't
open the file.

JDW

 
 
 

Can not write to /usr/local/httpd/htdocs

Post by Dave Bro » Mon, 30 Apr 2001 07:09:47




>>           open(FH,"> write_me.txt");
>> Does anynore know what do I have to do in order to get that thing running?
>> Has this problem something to do with permissions?

>    Possibly.  The directory would have to be writable by the user the
>web server is running as.  You might also want to try and get some more
>information out of Perl by making it
>open(FH, "> write_me.txt") or die "Ack!  Couldn't open write_me : $!";

>    which will tell you the particular reason Perl thinks it can't
>open the file.

Usually apache is run as a process owned by "nobody".  Therefore, for a
cgi-script to be able to write, you'd have to make the directory writeable
by "others".  Not something I think I'd do.  How about writing to /tmp?

--
Dave Brown  Austin, TX

 
 
 

1. Installing httpd to /var/httpd or to /usr/local/etc/httpd

Hello:

Question:

If I add a user to my linux (slackware 96 2.0.0 with apache) how can I
also give him a web directory?  (automatically.  what I do now is
change their home directory to /usr/local/etc/httpd/htdocs/their_name
and I am sure this is wrong).  Also, I am just doing this on my own
lan.

What about permissions for cgi-bin for example?  I had to change the
owner of cgi-bin to the user who was logging in before he could upload
files.  I tried changing the group but this did not help.

I have looked in faqs etc. but I have not found an answer (or
recognized it).

Peter

2. Help with execlp() function

3. Tell "configure" to use /usr/local/lib/sparcv9/ instead of /usr/local/lib/

4. Dymanic DIP script needed

5. ln /usr/local /newDrive/usr/local ?

6. List of ksh keywords

7. how do i build gnu apps in /usr not in /usr/local

8. Booting directly thru xdm - configuration files?

9. /usr/bin/ls /usr/ucb/ls /usr/local/bin/ls

10. can't modify /usr/local/apache/conf/httpd.conf PATH

11. httpd: caught SIGBUS, attempting to dump core in /usr/local/wwws

12. how to handle programmers who want to write in /usr/local/include?

13. /usr/local/bin/perl ->/usr/bin/perl