*BSD News Article 73574


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!nntp.coast.net!zombie.ncsc.mil!newsgate.duke.edu!godot.cc.duq.edu!newsfeed.pitt.edu!jlfox
From: jlfox+@pitt.edu (James L Fox)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: httpd through cron
Date: 13 Jul 1996 13:31:47 GMT
Organization: University of Pittsburgh
Lines: 90
Message-ID: <4s88g3$krt@usenet.srv.cis.pitt.edu>
NNTP-Posting-Host: unixs-eval.cis.pitt.edu


I posted the article below in what I think are the most appropriate groups 
but haven't received a reply yet. Thought I'd try here too.  BTW, [with
your help] I have FreeBSD running Apache on a GW-2000 which runs great.
The reason for the madness below is because my management wants to take
adavantage of the reliability from conditioned power, and daily backups
of our university's computer services.  Unfortunately, they aren't set
up yet to allow individual user access to /cgi-bin/.  Thus, the madness!

------------------------------------
Newsgroups: comp.infosystems.www.servers.unix,
            comp.infosystems.www.authoring.cgi
Subject: Launching httpd from cron

I'm trying to launch CERN httpd from cron under SunOs using AFS
(Andrew File System). I am a "mere mortal" user on an administered
system with no root or /cgi-bin/ access.

I'm using a PORT# in the 7000 range.

My httpd.config file has full paths for everything and declares nobody
and nogroup.  If I launch the following file from the foreground of a
login shell thusly...

(prompt)> nohup startup.httpd &

---------startup.httpd----------
/afs/pitt.edu/usrx/username/full/path/httpd -r 
                    /afs/pitt.edu/usrx/username/full/path/httpd.config
---------end of startup.httpd-------

...the server functions properly (at least as far as I can tell.)
My access, error logs and .pid file are created and written to and my
cgi is executable in MY /cgi-bin/ directory. File WRITES are also
accomplished by the cgi executables successfully according to permissions.

The system is rebooted nightly and I'm tired of logging in to relaunch
httpd every morning (1:30am!)  So,,

(prompt)> crontab -l
40 1 * * * /afs/pitt.edu/usrx/username/full/path/start.httpd

------start.httpd---------
#! /bin/sh		/* SHOULD THIS BE HERE IN THIS CONTEXT? */
#
umask 022		/* BTW, if all this .profile stuff is removed, */
MESSAGES=off		/* nothing changes  */
. /afs/pitt.edu/common/etc/profile.global
#
TTT=`ps -auxw | grep "httpd" | grep -v "grep" | grep "username"`
#
#  httpd already running?  /* Sometimes the system is NOT taken down */
if test -z "$TTT" ; then
        /afs/pitt.edu/usrx/username/full/path/httpd 
                    -r /afs/pitt.edu/usrx/username/full/path/httpd.config
fi
-------end of start.httpd----------

The server gets started ok but it appears to NOT to have inherited
the file access permissions of its parent, "username". httpd
apparently can't create(write privilege) the access and error logs
and the cgi executables have no write access.  I suspect that
if I made the whole account's file system writable by the world, it
might work!

These are my thoughts and things I've tried...
  1.  The problem might have to do with the "nobody" concept.
  2.  I tried a run substituting "username" for "nobody" in
      httpd.config - no difference
  3.  If cron is using the setuid function of unix it may
      be a problem with AFS.
  4.  I copied /usr/pitt/etc/httpd to /usr/var/tmp/httpd and did
      "chmod 4755 /usr/var/tmp/httpd", modified start.httpd above
      and kicked cron again. - no difference
  5.  "man crontab" tells me programs will run as the launcher -
      What is going on here???
  6.  Is httpd just doing things that make it only approriately
      launched through cron BY root?
  7.  Am I going to just have to acquire a unix box and set up and
      administer my own web server after all??

In summary --- launch from the foreground; no problems
               launch from cron; file access permission problems

Thanks for any insights,
--Jim Fox
p.s. Thanks to the responders to my previous posts that helped me
     get this far!