def set_effective_user(uid=None, gid=None):
 uid = (uid and parse_uid(uid))
 gid = (gid and parse_gid(gid))
 if uid:
  if ((not gid) and pwd):
   gid = pwd.getpwuid(uid).pw_gid
  setegid(gid)
  seteuid(uid)
 else:
  (gid and setegid(gid))

def set_effective_user ( uid = None , gid = None ) : uid = ( uid and parse_uid ( uid ) ) gid = ( gid and parse_gid ( gid ) ) if uid : if ( ( not gid ) and pwd ) : gid = pwd . getpwuid ( uid ) . pw_gid setegid ( gid ) seteuid ( uid ) else : ( gid and setegid ( gid ) )
change process privileges to new user/group .