#!/usr/bin/perl -w use strict; use English; my $child_pid = open(FROM_KID, "|-") or die "can't fork: $!"; if ($child_pid) { # am the parent read FROM_KID my $child_message = ; if( $child_message =~ m/ERROR accessing files/ ) { # Alert the sysadmin } # Else OK. wait $child_pid; # Wait for the child to quit before continuing. } else { # Change userID $EGID=22; # aka: $> $UID=22; # aka: $< # am the child; use STDIN/STDOUT normally if( test_access_files() ) { print "OK accessing files as userID 22\n"; } else { print "ERROR accessing files as userID 22\n"; } exit; }