def initgroups(uid, gid):
 if (not pwd):
  return
 username = pwd.getpwuid(uid)[0]
 if hasattr(os, u'initgroups'):
  return os.initgroups(username, gid)
 groups = [gr.gr_gid for gr in grp.getgrall() if (username in gr.gr_mem)]
 setgroups(groups)

def initgroups ( uid , gid ) : if ( not pwd ) : return username = pwd . getpwuid ( uid ) [ 0 ] if hasattr ( os , u'initgroups' ) : return os . initgroups ( username , gid ) groups = [ gr . gr_gid for gr in grp . getgrall ( ) if ( username in gr . gr_mem ) ] setgroups ( groups )
init process group permissions .