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. Advertising

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:
    367
    Mazen
    Jul 11, 2003
  2. Akaketwa
    Replies:
    1
    Views:
    4,821
    impaler
    Sep 22, 2006
  3. Replies:
    0
    Views:
    490
  4. Mazen

    DataGrid Column Width properties not effective

    Mazen, Jul 11, 2003, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    175
    Mazen
    Jul 11, 2003
  5. John Nagle

    Python FTP timeout value not effective

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

Share This Page