Re: Running pyblosxom as user script causes internal server error (fwd)
Wari Wahab <[email protected]>
| Newsgroups | gmane.comp.web.pyblosxom.user |
|---|---|
| Message-ID | <[email protected]> |
I am not sure if this works in Bala's setup, but one can set the
umask flag (for unix that is) to ensure that the operating system's
default file mask is overwritten.
On the main pyblosxom cgi, one can add the following lines in the
first few lines:
import os
os.umask(0)
Better still, for security reasons, one would only use os.umask()
before writing the comments file instead of having it as default:
# before write
import os
oldumask = os.umask(0)
file('foo','w').write('bar')
# after successful write, one can also use chmod
# here just in case, but we set the umask to the
# old settings here for now.
os.umask(oldumask)
If things works well, the file foo should be a 666 permissions, that
is read/write for owner, group and others.
One of the main reasons why Bala might not be able to delete the
comments file is probably due to a restrictive parent directory
permissions. I will try to create the comments directory and give it
777 myself, and maybe set the user bit.
Sometimes to override the server's behaviour, I would write a simple
shell script that deletes the desired file when fired with a browser.
This is done in cases where I cannot defeat the server's permissions.
i.e.
#!/bin/sh
$file = /path/to/file
rm -f $file
$result = $?
echo "Content-Type: text/plain"
echo
if [ $result = 0 ] ; then
echo "Deleted $file"
else
echo "Delete of $file failed"
fi
This problem is common, and there is no one correct answer to solve
this. Hope this helps you though.
On 04 Oct 2005, at 10:21 PM, will guaraldi wrote:
> Can someone help with this? I don't have this problem and don't
> really fiddle with these sorts of things much.
>
> /will
>
>
> ---------- Forwarded message ----------
> Date: Mon, 3 Oct 2005 22:45:41 -0500
> From: Bala B K <[email protected]>
> To: will guaraldi <[email protected]>
> Subject: Re: [pyblosxom-users] Running pyblosxom as user script
> causes internal
> server error
>
> Thanks for the fast reply.
>
> Well, I checked the Apache logs and all it says is a 500 error code.
> So, if there is no way I can get this thing to run with a setuid bit
> on, is there a way to make sure that the files (comments) that are
> created all way have 777 permissions (so that I can delete/move them
> myself instead of asking the sysadmin again and again)?
>
> Thanks again,
> Bala.
>
> On 10/3/05, will guaraldi <[email protected]> wrote:
>
>>
>> You should check your Apache error logs. But, I'm pretty sure Python
>> won't allow you to run scripts with a setuid bit on and will error
>> out if
>> you try.
>>
>> /will
>>
>>
>> On Mon, 3 Oct 2005, Bala B K wrote:
>>
>>>
>>> Hi,
>>> I have just started using pyblosxom. It is running on a sun
>>> server
>>> running solaris 5.8, Apache-SSL-US/1.1.1+1.2+1.3b3-dev. Recently, my
>>> blog had some comment spam and I had to disable comments completely.
>>> Worse, to get rid of the problematic comments I had to ask the
>>> sysadmin
>>> as the comments were owned by user "www" and I couldn't delete
>>> them. I
>>> tried including a line in the comments plugins to change the
>>> permission
>>> of the files created to 777, but that didn't work. So, I tried
>>> doing a
>>> **chmod u+s pyblosxom.cgi** so that the executable would run in
>>> my name.
>>> But that gives rise to HTTP error 500 (internal server error).
>>> Please
>>> help.
>>>
>>> Thanks,
>>> Bala.
>>>
>>
>>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by:
> Power Architecture Resource Center: Free content, downloads,
> discussions,
> and more. http://solutions.newsforge.com/ibmarch.tmpl
> _______________________________________________
> pyblosxom-users mailing list
> pyblosxom-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> https://lists.sourceforge.net/lists/listinfo/pyblosxom-users
>
>
-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl