markg has asked for the wisdom of the Perl Monks concerning the following question:
Here is the code and result that I have used to test this. I am running Slackware 10.2 and a 2.4.31 kernel. Any suggestions? Is this a potential bug in Perl?
mgrimes@pip$ cat priv.pl #!/usr/bin/perl use strict; use warnings; print `id`; my ($login,$pass,$uid,$gid) = getpwnam('nobody'); ($<,$>) = ($uid,$uid); ($),$() = ($gid,$gid); print "Dropped privilege\n"; print `id`; print `cat priv_file`; mgrimes@pip$ ll priv_file -rw-r----- 1 root root 11 2006-09-08 15:15 priv_file root@pip$ ./priv.pl uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm) Dropped privilege uid=99(nobody) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(ad +m) Privileged - you shouldn't see this!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Dropping Privileges
by Fletch (Bishop) on Sep 09, 2006 at 00:41 UTC | |
by markg (Novice) on Sep 09, 2006 at 06:26 UTC |