Matt S Trout has asked for the wisdom of the Perl Monks concerning the following question:

I keep getting problems with perl CGI scripts (under apache and FreeBSD) producing files owned by userid 1000, as opposed to user www. This is causing problems, since there is no user under id 1000 and so the script doesn't then have rights to change this file. A couple of other things on our servers have also started doing this recently (notably Actinic Catalog); I was wondering if any monks out there had any idea what was causing this?
  • Comment on CGI scripts creating files with odd ownerships

Replies are listed 'Best First'.
Re: CGI scripts creating files with odd ownerships
by Zaxo (Archbishop) on Jun 27, 2001 at 19:31 UTC

    That sounds like Apache suEXEC is misconfigured, unless 'nobody' or 'www' has uid 1000. Uid nobody is often 99.

    The Apache docs give details, but suEXEC is configured per vhost. There is also a setting in *.conf for the user httpd runs as.

    After Compline,
    Zaxo

      None of the scripts are using suid; the httpd conf file is set to
      User www
      Group www
      but we're still getting the uid 1000 files created.

        Ok, next step is to check that user and group 'www' exist on the system (grep www /etc/{passwd,groups} or perl -e 'print getpwnam("www"),$/,getgrnam("www"),$/'). If that turns up no problem, look again for suEXEC setup. It's not the same thing as setting the suid bit on the scripts.  $ httpd -l -L -V will assist in that.

        After Compline,
        Zaxo

Re: CGI scripts creating files with odd ownerships
by bwana147 (Pilgrim) on Jun 27, 2001 at 19:55 UTC

    Is the filesystem you store your files on mounted via nfs our smb? There are configuration options to impose a given UID/GID for writing or reading files.

    --bwana147