"Justin Johnson" <justinjohnson at fastmail.fm> wrote in message news:<mailman.1060697959.27558.python-list at python.org>...
I have a unix id that has group1 for a primary group, and group2, group3,
and group4 for supplementary groups. I'd like to change my primary group
before running certain commands. So sometimes I might want group2 to be
the primary group, and other times group3 or group4.

I saw the posix module's setgid method, but it failed for me unless I was
running as root. Also it only accepts the gid, but I'd rather pass in
the group name, or somehow lookup the gid based on the name.

Does anyone know a way to do all of this?
Thanks much.
These are not python solution;

1) make a setgid script and put your commands there, or
2) use shell commands;

echo "command1; command2;" | newgrp group2


Search Discussions

Discussion Posts


Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 2 of 5 | next ›
Discussion Overview
grouppython-list @
postedAug 12, '03 at 2:18p
activeAug 13, '03 at 7:30p



site design / logo © 2022 Grokbase