- or download this
#!/usr/bin/perl -w
use strict;
use POSIX qw(setgid setsid setuid);
...
print OUTFILE "$_[0] pid $$\n user real $< effective $>\n group
+real $( effective $)\n";
close OUTFILE;
}
- or download this
$< = $user[2];
$> = $user[2];
$( = $user[3];
$) = $user[3];
- or download this
root 15569 8068 0 16:06:31 pts/12 0:00 /usr/bin/perl -w daemon
+_gid_test.pl
furrypop 15570 15569 0 16:06:31 ? 0:00 /usr/bin/perl -w daemon
+_gid_test.pl
- or download this
Start pid 15569
user real 0 effective 0
...
Child pid 15570
user real 514 effective 514
group real 1 12 9 8 7 6 5 4 3 2 0 1 effective 1 12 9 8 7 6 5 4 3 2 0
+ 1
- or download this
setuid $user[2] or die "Cannot switch ID to $dmon_id: $!";
setgid $user[3] or die "Cannot switch group for $dmon_id: $!";
- or download this
root 15588 8068 0 16:08:50 pts/12 0:00 /usr/bin/perl -w daemon
+_gid_test.pl
root 15589 15588 0 16:08:50 ? 0:00 /usr/bin/perl -w daemon
+_gid_test.pl
- or download this
Start pid 15588
user real 0 effective 0
...
Child pid 15589
user real 514 effective 0
group real 350 12 9 8 7 6 5 4 3 2 0 1 effective 1 12 9 8 7 6 5 4 3 2
+ 0 1