[Baypiggies] Python newgroup quick question/answer?

Benjamin Sergeant bsergean at gmail.com
Thu Oct 15 22:27:57 CEST 2009


A good place to dig for samples of the group module usage is probably
http://www.doughellmann.com/PyMOTW/grp/index.html

- Benjamin


On Thu, Oct 15, 2009 at 1:12 PM, Glen Jarvis <glen at glenjarvis.com> wrote:
> BTW....
>    I already know about the following (and wrote the following code). I'd
> rather log them into the group during the execution of the script, though,
> if I could:
>     # Must be logged into bpg group
>     if not os.getgid() == _BPG_GID:
>         sys.stderr.write(
>             "\nERROR: You must be logged into bpg group! See: man
> newgrp\n\n")
>         sys.exit(1)
>
> Cheers,
>
> Glen
> On Thu, Oct 15, 2009 at 1:03 PM, Glen Jarvis <glen at glenjarvis.com> wrote:
>>
>> I know.. I know.. RTFM :)  I usually do the digging myself. However, I'm
>> not finding what I think is probably there.
>> My users are in two Linux groups, A and B. The script that I'm writing
>> should log them into B (newgrp B from the linux prompt).
>> Since Python 'fits your brain,' generally, I would expect something like
>> os.newgroup('B'), os.newgrp('B'), or os.logingroup('B'). I'm not finding,
>> it, however.
>>
>> Anyone know this off the top of their head?
>> If there's no library, am I guaranteed to retain the group if I use
>> subprocess?
>>
>> Cheers,
>>
>> Glen
>
> _______________________________________________
> Baypiggies mailing list
> Baypiggies at python.org
> To change your subscription options or unsubscribe:
> http://mail.python.org/mailman/listinfo/baypiggies
>


More information about the Baypiggies mailing list