swaroop has asked for the wisdom of the Perl Monks concerning the following question:

Folks, I'm gettin wired error while changing EGID bit.

* The script will run as "root" and copies the files from local filesystem to nfs.

* The nfs share have write access to "user1".

=========================================

use strict; use English; use File::Copy qw(cp); use Crap qw(croak); my ($old_euid,$old_egid); $old_euid = $>; $old_egid = $); # now change the euid and egid to "user1" $> = "23333"; # new uid $) = "7755"; # "user1" primary group. croak("failed to copy ") unless ( cp("/var/tmp/srcfile","/x/tmp/dstfil +e") );
========================================

I see the file in /x/tmp/dstfile with the user "user1" but the group id is "bin" ( root primary group ).

I'm happy to see the files with the group "7755".

Many thanks !!!

Edit: g0n - code tags

Replies are listed 'Best First'.
Re: EUID and EGID
by merlyn (Sage) on Feb 26, 2006 at 12:57 UTC
      Thanks !!!
Re: EUID and EGID
by bluto (Curate) on Feb 27, 2006 at 17:59 UTC
    use Crap qw(croak);

    I'm not sure what that module is used for, nor do I want to find out... :-)