Date: Wed, 9 Oct 2002 17:45:48 -0400 (EDT) From: Mikhail Kruk <meshko@cs.brandeis.edu> To: <freebsd-questions@freebsd.org> Subject: setregid question Message-ID: <Pine.LNX.4.33.0210091741490.1237-100000@iole.cs.brandeis.edu>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.LNX.4.33.0210091741490.1237-100000>