Effective Group ID not changing

Discussion in 'Perl Misc' started by Aaron Baugher, Jul 22, 2003.

  1. I have a program that runs as root and accepts logins and commands
    through a network socket. On each login, it changes the effective uid
    and gid to that of the user, like so:

    my( $uid, $gid ) = (getpwnam($user))[2,3];
    $> = $uid;
    $) = $gid;

    In most cases, $gid will be 1001, and $uid will be > 1000. This
    worked fine on FreeBSD, and files created after this point would be
    created with the uid/gid ownership assigned here. I recently tried
    running this program on RedHat (perl 5.6.1), and the gid doesn't
    change, although the uid does. If I print $), it still contains a
    list of root's groups, and files created get root's group ownership.

    Is there something I should be doing differently to get this to work?
    My program has to be able to reset these values repeatedly; that's why
    I don't set $( (Real gid). I figured I wouldn't be able to set it
    back after that.


    Thanks,
    --
    Aaron
     
    Aaron Baugher, Jul 22, 2003
    #1
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mazen
    Replies:
    0
    Views:
    442
    Mazen
    Jul 11, 2003
  2. Akaketwa
    Replies:
    1
    Views:
    6,030
    impaler
    Sep 22, 2006
  3. Replies:
    0
    Views:
    744
  4. christopher taylor
    Replies:
    0
    Views:
    536
    christopher taylor
    Sep 17, 2008
  5. cpld-fpga-asic
    Replies:
    13
    Views:
    1,400
    rickman
    Jul 6, 2009
  6. Mazen

    DataGrid Column Width properties not effective

    Mazen, Jul 11, 2003, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    252
    Mazen
    Jul 11, 2003
  7. Dag Sunde
    Replies:
    0
    Views:
    243
    Dag Sunde
    Nov 18, 2005
  8. John Nagle

    Python FTP timeout value not effective

    John Nagle, Sep 2, 2013, in forum: Python
    Replies:
    3
    Views:
    349
    Terry Reedy
    Sep 3, 2013
Loading...