Posts tagged ‘suexec’

On one of my apache I use suexec to run some tasks – some weeks before I configure all it and all stuff works well, but some days later when I try to run my cgi-perl script I found I have “500 Internal error”. I change nothing in apache config or in my scripts – I just install fresh updates for ubuntu. In apache’s error log I’ve got :

[Wed Jul 29 08:15:28 2009] [error] (13)Permission denied: exec of ‘/usr/lib/apache2/suexec’ failed
[Wed Jul 29 08:15:28 2009] [error] [client my_ip] Premature end of script headers:

It’s strange, but anyway it doesn’t works. I spent some time trying to fix it ( some guys recommend to rebuilt suexec – but it’s not a simplest way to fix this problem ) – in my case it was fixed by changing owner of my suexec. I check out current properties :
ls -la /usr/lib/apache2/suexec
-rwsr-xr– 1 root www-data 18872 2009-07-10 18:40 /usr/lib/apache2/suexec
and change them :

chown root:root /usr/lib/apache2/suexec
chmod 4755 /usr/lib/apache2/suexec

And don’t forget to restart :

/etc/init.d/apache2 restart

ps. by the way suexec’s id’s are :

#id www-user
uid=1000(www-user) gid=109(www-group) groups=109(www-group)