I'm trying to create a directory with permissions 2755... that's 755 with set group ID (as described in man chmod).
here's a little test to demonstrate my problem:
Code:
>>> import os
>>> os.mkdir("/tmp/testmods/a",0777)
>>> os.mkdir("/tmp/testmods/b",0755)
>>> os.mkdir("/tmp/testmods/c",2777)
>>> os.mkdir("/tmp/testmods/d",2755)
>>> os.umask(0)
>>> os.mkdir("/tmp/testmods/e",2755)
>>> os.umask(777)
>>> os.mkdir("/tmp/testmods/f",2755)
>>> os.umask(0777)
>>> os.mkdir("/tmp/testmods/g",2755)
... and you can see the output it nothing like I'd expect:
Code:
>ls -l /tmp/testmods/
total 28K
4.0K drwxrwsr-x 2 briank cg 4.0K 2009-01-27 12:47 a/ <~~ As I'd expect
4.0K drwxr-sr-x 2 briank cg 4.0K 2009-01-27 12:47 b/ <~~ Also good.
4.0K d-wx-ws--t 2 briank cg 4.0K 2009-01-27 12:47 c/ <~~ From here down, I'm lost.
4.0K d-wx--S--t 2 briank cg 4.0K 2009-01-27 12:47 d/
4.0K d-wx--S-wt 2 briank cg 4.0K 2009-01-27 12:48 e/
4.0K d-wx--S-wT 2 briank cg 4.0K 2009-01-27 12:48 f/
4.0K d-----S--T 2 briank cg 4.0K 2009-01-27 12:49 g/
What I'm trying to do is this:
Code:
akane:/tmp/testmods>mkdir cli
akane:/tmp/testmods>chmod 2755 !$
chmod 2755 cli
akane:/tmp/testmods>ls -ld !$
ls -ld cli
4.0K drwxr-sr-x 2 briank cg 4.0K 2009-01-27 12:52 cli/ <~~ This is what I want
What am I doing wrong in python? Rather, what do I need to do differently to get the same results?
Thanks
edited to add: os.chmod() gives the same results as os.mkdir() re: permissions