[Tutor] permissions and other hairpulls

Magnus Lyckå magnus@thinkware.se
Sun May 11 17:25:02 2003


At 08:56 2003-05-11 -0400, Kirk Bailey wrote:
>permissions in FreeBSD are the most fustrating aspect of web scripting.

This in nothing particular for FreeBSD...

>Here is an error:
>Traceback (innermost last):
>    File "/www/www.listville.net/cgi-bin/TLlistmaker2.py", line 195, in ?
>      os.chmod(fullpathtoscript+'/lists/'+mylist,666)
>OSError: [Errno 79] Inappropriate file type or format:
>'/www/www.listville.net/cgi-bin/lists/test33'

Surely chmod doesn't want decimal 666? It wants octal
numbers! That's what the chmod codes are, an octal
representation for

rwxrwxrwx
110110110

In octal this is 666. To make python interpret it as
octal, write 0666. (Or write 438 if you want to confuse
people! ;)

os.chmod(fullpathtoscript+'/lists/'+mylist,0666)

(Who ever said zero means nothing?)

666 is octal 1232, and that's not what you want!

>The script is attempting to set the mod to 666 for a file just created and 
>closed.
>It is created by the script, and examination shows it is 644.

This is because umask = 022 I guess...

>Another scipt is trying later to add to it, and failing, for a permissions 
>reason. ALL
>scripts are 755, owned by nobody:wheel. All such text files are also 
>nobody:wheel, and
>work fine when 666, but problems when 644. Any suggestions from the brethern?



--
Magnus Lycka (It's really Lyckå), magnus@thinkware.se
Thinkware AB, Sweden, www.thinkware.se
I code Python ~ The shortest path from thought to working program