A
Aaron Baugher
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,
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,