Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

EUID and EGID

by swaroop (Beadle)
on Feb 26, 2006 at 11:59 UTC ( [id://532867]=perlquestion: print w/replies, xml ) Need Help??

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... :-)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://532867]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2024-04-24 07:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found