Changing UNIX primary group

Justin Johnson justinjohnson at fastmail.fm
Tue Aug 12 10:18:50 EDT 2003


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.
-Justin





More information about the Python-list mailing list