From owner-freebsd-questions Wed Oct 9 14:26:44 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 62CC837B401 for ; Wed, 9 Oct 2002 14:26:43 -0700 (PDT) Received: from iole.cs.brandeis.edu (iole.cs.brandeis.edu [129.64.3.240]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9AC2B43E42 for ; Wed, 9 Oct 2002 14:26:42 -0700 (PDT) (envelope-from meshko@cs.brandeis.edu) Received: from localhost (meshko@localhost) by iole.cs.brandeis.edu (8.11.6/8.11.6) with ESMTP id g99LjmI03133 for ; Wed, 9 Oct 2002 17:45:49 -0400 X-Authentication-Warning: iole.cs.brandeis.edu: meshko owned process doing -bs Date: Wed, 9 Oct 2002 17:45:48 -0400 (EDT) From: Mikhail Kruk To: Subject: setregid question Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG I have the following program: main() { printf("uid: %d\n", getuid()); printf("euid: %d\n", geteuid()); system("/root/uid.sh"); setreuid(geteuid()); setregid(getegid()); printf("uid: %d\n", getuid()); printf("euid: %d\n", geteuid()); system("/root/uid.sh"); } where uid.sh runs 'id' command. I make executable chown meshko a.out; chgrp meshko a.out ; chmod 6770 a.out and when I run it I get the following output: uid: 0 euid: 1001 uid=0(root) euid=1001(meshko) gid=0(wheel) egid=1001(meshko) groups=1001(meshko), 0(wheel), 2(kmem), 3(sys), 4(tty), 5(operator), 20(staff), 31(guest) uid: 1001 euid: 1001 uid=1001(meshko) gid=1001(meshko) groups=1001(meshko), 0(wheel), 2(kmem), 3(sys), 4(tty), 5(operator), 20(staff), 31(guest) It seems to do everything the way I expect it, except for the printout of the group membership. I'm trying to lower my real group id to my effective group id, and gid output reflects the change, but I still get the list of groups in which root it... How come? To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message