On Tue, Jan 23, 2024 at 2:02 PM EML <sa212+apa...@cyconix.com> wrote:
> The CGI Howto page contains some basic information on how Apache actually > runs a program, but is there any more detailed information anywhere? > > Specifically, I have a problem where a bash script runs as expected when > run from an interactive shell by user www-data (this is Ubuntu). However, > the script behaves differently when run via Apache from a web client. This > is nothing to do with PATH or envvar differences: when run by Apache, an > operation to unmount a disk appears to succeed, but actually doesn't > unmount the disk. When run from the interactive shell, as the same user, > the operation unmounts the disk. > > This is a basic Apache install on Ubuntu 22.04 - no suexec, no chroot, > plain CGI, etc. I've been running scripts via Apache this way for years, > but this is the first script which attempts to carry out disk operations. > All these scripts appear in the sudoers file to allow Apache to carry out > specific privileged operations. > > I asked this question <https://unix.stackexchange.com/q/767587/212513> > today on StackExchange (https://unix.stackexchange.com/q/767587/212513, > if the link is scrubbed), with much more detail, but I think that was > probably the wrong place to ask. > > Thanks. > Let's take a step back - why are you unmounting from a cgi script?