One of the programs in my cgi-bin folder is misbehaving. It's a compiled binary for which I do not have the source code. I would like to set up some kind of monitor to gather a list of the files that the program opens when it gets executed and dump that into a text file.
It looks like lsof
might have that info, but since the CGI program is transient and typically finishes execution in under a second, it's not really practical to run lsof
from the command line at the same time. For that matter, I'm not even sure if the CGI program would show up as itself or if the activity would be registered to the httpd
process.
The server is running Red Hat Enterprise Linux 6.4 with Apache 2.2.15, and I have root access.
Suggestions?
You can use
strace
to find out what your cgi-bin program does. See this question on StackOverflow about how to usestrace
.