Re: Permission denied
Martijn de Munnik <martijn-3hbljVilL9r/[email protected]>
| Newsgroups | gmane.comp.web.fastcgi.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi David,
Thank you for your suggestions. I tried a truss on the apache process
(truss -f - p <Apache PID>, first time I've used truss) and got the
following output. I've noticed the following line with seems strange
to me.
10130: stat64("/opt/csw/apache2/share/htdocs/suexec/
goedkooplpgtanken.nl/php5-cgi/index.php", 0x08047970) Err#20 ENOTDIR
It is the first time I've used truss so I'm don't realy know what I'm
looking at. I've also tried a test.fcgi script without suexec and
this also doesn't work, same error in the apache error_log.
The complete output:
10130: fork1() (returning as child ...) = 10007
10130: getpid() = 10130 [10007]
10130: lwp_self() = 1
10130: lwp_sigmask(SIG_SETMASK, 0x00000000, 0x00000000) = 0xFFBFFEFF
[0x0000FFFF]
10130: sigaction(SIGHUP, 0x08047C10, 0x08047C80) = 0
10130: sigaction(SIGTERM, 0x08047C10, 0x08047C80) = 0
10130: sigaction(SIGUSR1, 0x08047C10, 0x08047C80) = 0
10130: getpid() = 10130 [10007]
10130: getpid() = 10130 [10007]
10130: getuid() = 0 [0]
10130: setgid(60001) = 0
10130: sysconfig(_CONFIG_NGROUPS) = 16
10130: open("/etc/default/nss", O_RDONLY|O_LARGEFILE) = 35
10130: fcntl(35, F_DUPFD, 0x00000100) = 256
10130: close(35) = 0
10130: read(256, " # i d e n t\t " @ ( #".., 1024) = 1024
10130: read(256, " y t h o s e\n # f u n".., 1024) = 211
10130: read(256, 0xFE642400, 1024) = 0
10130: close(256) = 0
10130: getuid() = 0 [0]
10130: getuid() = 0 [0]
10130: door_info(3, 0x080475E0) = 0
10130: door_call(3, 0x08047638) = 0
10130: setgroups(3, 0x08152638) = 0
10130: getuid() = 0 [0]
10130: setuid(60001) = 0
10130: close(18) = 0
10130: close(16) = 0
10130: getpid() = 10130 [10007]
10130: time() = 1201083028
10130: getpid() = 10130 [10007]
10130: getpid() = 10130 [10007]
10130: fcntl(34, F_SETLKW, 0xFE97DE78) = 0
10130: pollsys(0x0834A6E0, 2, 0x00000000, 0x00000000) (sleeping...)
10130: pollsys(0x0834A6E0, 2, 0x00000000, 0x00000000) = 1
10130: accept(5, 0x0834C730, 0x0834C71C, SOV_DEFAULT) = 16
10130: fcntl(34, F_SETLKW, 0xFE97DEA0) = 0
10130: getsockname(16, 0x0834C6E8, 0x0834C6D4, SOV_DEFAULT) = 0
10130: read(16, " G E T / i n d e x . p".., 8000) = 408
10130: stat64("/home/goedkooplpgtanken.nl/public_html/index.php",
0x08047A10) = 0
10130: open("/home/goedkooplpgtanken.nl/public_html/.htaccess",
O_RDONLY|O_LARGEFILE) Err#2 ENOENT
10130: open("/home/goedkooplpgtanken.nl/public_html/
index.php/.htaccess", O_RDONLY|O_LARGEFILE) Err#20 ENOTDIR
10130: getpid() = 10130 [10007]
10130: stat64("/opt/csw/apache2/share/htdocs/suexec/
goedkooplpgtanken.nl/php5-cgi/index.php", 0x08047970) Err#20 ENOTDIR
10130: lstat64("/opt", 0x08047970) = 0
10130: lstat64("/opt/csw", 0x08047970) = 0
10130: lstat64("/opt/csw/apache2", 0x08047970) = 0
10130: lstat64("/opt/csw/apache2/share", 0x08047970) = 0
10130: lstat64("/opt/csw/apache2/share/htdocs", 0x08047970) = 0
10130: lstat64("/opt/csw/apache2/share/htdocs/suexec", 0x08047970) = 0
10130: lstat64("/opt/csw/apache2/share/htdocs/suexec/
goedkooplpgtanken.nl", 0x08047970) = 0
10130: lstat64("/opt/csw/apache2/share/htdocs/suexec/
goedkooplpgtanken.nl/php5-cgi", 0x08047970) = 0
10130: getpid() = 10130 [10007]
10130: xstat(2, "/opt/csw/apache2/share/htdocs/suexec/
goedkooplpgtanken.nl/php5-cgi", 0x08357F58) = 0
10130: brk(0x08374F00) = 0
10130: brk(0x08376F00) = 0
10130: brk(0x08376F00) = 0
10130: brk(0x0837AF00) = 0
10130: brk(0x0837AF00) = 0
10130: brk(0x0837CF00) = 0
10130: brk(0x0837CF00) = 0
10130: brk(0x08380F00) = 0
10130: brk(0x08380F00) = 0
10130: brk(0x08382F00) = 0
10130: stat64("/home/goedkooplpgtanken.nl/public_html/index.php",
0x08047670) = 0
10130: xstat(2, "/opt/csw/apache2/share/htdocs/suexec/tmp/dynamic/
ebdbed12405780bdcdf8d9c3caffeb8d", 0x080476B0) Err#2 ENOENT
10130: write(25, " S / o p t / c s w / a".., 81) = 81
10130: pollsys(0x08047610, 0, 0x08047660, 0x00000000) = 0
10130: xstat(2, "/opt/csw/apache2/share/htdocs/suexec/tmp/dynamic/
ebdbed12405780bdcdf8d9c3caffeb8d", 0x080476B0) = 0
10130: so_socket(PF_UNIX, SOCK_STREAM, 0, "", SOV_DEFAULT) = 18
10130: connect(18, 0x0837F148, 83, SOV_DEFAULT) = 0
10130: fcntl(18, F_GETFL) = 2
10130: fcntl(18, F_SETFL, FWRITE|FNONBLOCK) = 0
10130: pollsys(0x080477E0, 1, 0x080478D0, 0x00000000) = 1
10130: write(18, "0101\001\0\b\0\0\001\0\0".., 1369) = 1369
10130: pollsys(0x080477E0, 1, 0x080478D0, 0x00000000) (sleeping...)
10130: pollsys(0x080477E0, 1, 0x080478D0, 0x00000000) = 0
10130: write(25, " T / o p t / c s w / a".., 81) = 81
10130: pollsys(0x080477E0, 1, 0x080478D0, 0x00000000) (sleeping...)
Martijn
On 22-jan-2008, at 17:06, David Birnbaum wrote:
> Martijn,
>
> Well, if you can't tell from inspection why the exec is failing,
> then what I usually do is truss or strace the proc manager and
> watch the various system calls are that fail. Usually that gives
> me the information I need to track it down. Unfortunately, it's
> very much based on your specific installation so you're somewhat on
> your own. Try following the whole chain as the right user (start
> as root, make sure you can cd where httpd is when it forks off
> suexec, become the user, and continue to trace execution through)
> until you find the place where permissions are set wrong, either on
> a cd, exec, stat, etc.
>
> David.
>
>
> Martijn de Munnik wrote:
>>
>> Hi David,
>>
>> Thank you for your reply! I tried what you said and these are the
>> result. I can't cd into /opt/csw/apache2/sbin where the suexec
>> binary is but I guess root needs to run suexec and the suexec
>> process runs the php5-cgi fastcgi script.
>>
>> ------------
>>
>> -bash-3.2$ pwd
>> /opt/csw/apache2
>> -bash-3.2$ id
>> uid=10000(goedkooplpgtanken.nl) gid=10000(goedkooplpgtanken.nl)
>> -bash-3.2$ /opt/csw/apache2/share/htdocs/suexec/
>> goedkooplpgtanken.nl/php5-cgi
>> <?php echo("It works.\n"); ?>
>> Content-type: text/html
>>
>> It works.
>> -bash-3.2$
>>
>> ------------
>>
>> Martijn
>>
>> On 21-jan-2008, at 16:39, David Birnbaum wrote:
>>
>>> Martijn,
>>>
>>> Well, the error looks pretty explicit:
>>>
>>> [Mon Jan 21 11:55:38 2008] [warn] FastCGI: (dynamic) server "/opt/
>>> csw/apache2/share/htdocs/suexec/goedkooplpgtanken.nl/php5-
>>> cgi" (uid 10000, gid 10000) started (pid 26418)
>>> FastCGI: can't start server "/opt/csw/apache2/share/htdocs/suexec/
>>> goedkooplpgtanken.nl/php5-cgi" (pid 26418), execle() failed:
>>> Permission denied
>>> The execle() error message is passed back from the OS. Is it
>>> possible that you're not really testing as UID 10,000 the same we
>>> suexec is running things? Do an "id" before you launch it, and
>>> see if it's returning the right thing. Also, run the whole line
>>> from the command line when cd'd in the same the directory that
>>> suexec is launching from, and make sure it properly starts up
>>> that way as well.
>>>
>>> David.
>>>
>>>
>>> Martijn de Munnik wrote:
>>>>
>>>> Hi,
>>>>
>>>> my apache error_log show the following error. I've also tried
>>>> without the suexec wrapper and I'm quiet sure that suexec is not
>>>> the problem. I can run the php5-cgi script from the commandline
>>>> as the user with uid 10000 without any problem?
>>>>
>>>> Any ideas?
>>>>
>>>>
>>>>
>>>> [Mon Jan 21 11:55:23 2008] [notice] suEXEC mechanism enabled
>>>> (wrapper: /opt/csw/apache2/sbin/suexec)
>>>> [Mon Jan 21 11:55:23 2008] [notice] mod_python: Creating 8
>>>> session mutexes based on 256 max processes and 0 max threads.
>>>> [Mon Jan 21 11:55:23 2008] [notice] mod_python: using
>>>> mutex_directory /tmp
>>>> [Mon Jan 21 11:55:23 2008] [notice] Digest: generating secret
>>>> for digest authentication ...
>>>> [Mon Jan 21 11:55:23 2008] [notice] Digest: done
>>>> [Mon Jan 21 11:55:23 2008] [notice] Apache/2.2.6 (Unix) mod_ssl/
>>>> 2.2.6 OpenSSL/0.9.8g mod_fastcgi/2.4.2 DAV/2 SVN/1.4.5
>>>> mod_python/3.3.1 Python/2.5.1 configured -- resuming normal
>>>> operations
>>>> [Mon Jan 21 11:55:23 2008] [notice] FastCGI: wrapper mechanism
>>>> enabled (wrapper: /opt/csw/apache2/sbin/suexec)
>>>> [Mon Jan 21 11:55:23 2008] [notice] FastCGI: process manager
>>>> initialized (pid 26387)
>>>> [Mon Jan 21 11:55:38 2008] [warn] FastCGI: (dynamic) server "/
>>>> opt/csw/apache2/share/htdocs/suexec/goedkooplpgtanken.nl/php5-
>>>> cgi" (uid 10000, gid 10000) started (pid 26418)
>>>> FastCGI: can't start server "/opt/csw/apache2/share/htdocs/
>>>> suexec/goedkooplpgtanken.nl/php5-cgi" (pid 26418), execle()
>>>> failed: Permission denied
>>>> [Mon Jan 21 11:55:38 2008] [warn] FastCGI: (dynamic) server "/
>>>> opt/csw/apache2/share/htdocs/suexec/goedkooplpgtanken.nl/php5-
>>>> cgi" (pid 26418) terminated by calling exit with status '255'
>>>> [Mon Jan 21 11:55:45 2008] [warn] FastCGI: (dynamic) server "/
>>>> opt/csw/apache2/share/htdocs/suexec/goedkooplpgtanken.nl/php5-
>>>> cgi" (uid 10000, gid 10000) restarted (pid 26420)
>>>> FastCGI: can't start server "/opt/csw/apache2/share/htdocs/
>>>> suexec/goedkooplpgtanken.nl/php5-cgi" (pid 26420), execle()
>>>> failed: Permission denied
>>>> [Mon Jan 21 11:55:45 2008] [warn] FastCGI: (dynamic) server "/
>>>> opt/csw/apache2/share/htdocs/suexec/goedkooplpgtanken.nl/php5-
>>>> cgi" (pid 26420) terminated by calling exit with status '255'
>>>> [Mon Jan 21 11:55:51 2008] [warn] FastCGI: (dynamic) server "/
>>>> opt/csw/apache2/share/htdocs/suexec/goedkooplpgtanken.nl/php5-
>>>> cgi" (uid 10000, gid 10000) restarted (pid 26421)
>>>> FastCGI: can't start server "/opt/csw/apache2/share/htdocs/
>>>> suexec/goedkooplpgtanken.nl/php5-cgi" (pid 26421), execle()
>>>> failed: Permission denied
>>>> [Mon Jan 21 11:55:51 2008] [warn] FastCGI: (dynamic) server "/
>>>> opt/csw/apache2/share/htdocs/suexec/goedkooplpgtanken.nl/php5-
>>>> cgi" (pid 26421) terminated by calling exit with status '255'
>>>>
>>>>
>>>> ___________________________________
>>>> fastcgi-developers mailing list
>>>> http://fastcgi.com/fastcgi-developers/
>>>>
>>
>>
>> ___________________________________
>> fastcgi-developers mailing list
>> http://fastcgi.com/fastcgi-developers/
>>
> !DSPAM:479614962211821340132!
___________________________________
fastcgi-developers mailing list
http://fastcgi.com/fastcgi-developers/