Automatic chmod

Victor Subervi victorsubervi at
Fri Oct 9 15:20:57 UTC 2009

User? I only have one user on this shared server. Here's the code:

import cgitb; cgitb.enable()
import MySQLdb
import cgi
import sys,os
from login import login
user, passwd, db, host = login()
form = cgi.FieldStorage()
picid = int(form['id'].value)
x = int(form['x'].value)
pics = {1:'pic1',2:'pic2',3:'pic3',4:'pic4',5:'pic5',6:'pic6'}
pic = pics[x]
db = MySQLdb.connect(host=host, user=user, passwd=passwd, db=db)
cursor= db.cursor()
sql = "select " + pic + " from productsX where id='" + str(picid) + "';"
content = cursor.fetchall()[0][0].tostring()
print '''Content-Type: text/plain
Content-Encoding: base64
print content.encode('base64')


On Fri, Oct 9, 2009 at 10:14 AM, Richard Mahlerwein <mahlerrd at>wrote:

> >From: Victor Subervi <victorsubervi at>
> >Subject: Automatic chmod
> >To: freebsd-questions at
> >Date: Friday, October 9, 2009, 10:19 AM
> >
> >Hi;
> >I have a python script that automatically writes another script. I need to
> >be able to automatically chmod the script so that it will execute. Also,
> it
> >appears that's not enough, because when I manually chmod the script (775),
> >it throws this error:
> >fopen: Permission denied
> >TIA,
> >V
> What user are you running this under?  Without seeing code, my first guess
> is that you are trying to open a file you don't have permission to open.
> The chmod you are doing only affects the script's permissions, not the
> permissions of the files it may touch.
> For more, I suggest posting the code itself.
> -Rich

More information about the freebsd-questions mailing list