use English; # Avoid $<, etc. my $username = "nobody"; my ($n,$p, $u,$g, $q,$c,$gc,$dir,$sh); ($n,$p, $u,$g, $q,$c,$gc,$dir,$sh)=getpwnam( $username ); # If we have a uid + gid switch to it. if ( defined( $u ) and defined( $g ) ) { # NOTE: Switch GID first - because once switching UID. # switching GID fails. # $GID = $g; $EGID= $g; $UID = $u; $EUID= $u; }