H
hakim
Hi list,
I have the following script, and it gets started as root:
#!/usr/bin/perl -w
use strict;
use POSIX;
my $uid;
my $gid;
if(($uid = getpwnam("iday")) && ($gid = getgrnam("iday"))) {
print "iday:\n";
print "UID = $uid\n";
print "GID = $gid\n";
$< = $> = $uid;
$( = $) = $gid;
} elsif(($uid = getpwnam("idayserv")) && ($gid =
getgrnam("idayserv"))) {
print "idayserv:\n";
print "UID = $uid\n";
print "GID = $gid\n";
} else {
print "Sorry\n";
}
while(1) {
sleep 10;
}
With "ps -ax -o euid,egid,user,group,command":
EUID EGID USER GROUP COMMAND
1001 0 iday root /usr/bin/perl -w ./test
The user iday has uid 1001 and gid 1001 (groupname iday), but that
does not show up.
How can I change the process uid and gid for example like an apache
server does?
Thanks...
I have the following script, and it gets started as root:
#!/usr/bin/perl -w
use strict;
use POSIX;
my $uid;
my $gid;
if(($uid = getpwnam("iday")) && ($gid = getgrnam("iday"))) {
print "iday:\n";
print "UID = $uid\n";
print "GID = $gid\n";
$< = $> = $uid;
$( = $) = $gid;
} elsif(($uid = getpwnam("idayserv")) && ($gid =
getgrnam("idayserv"))) {
print "idayserv:\n";
print "UID = $uid\n";
print "GID = $gid\n";
} else {
print "Sorry\n";
}
while(1) {
sleep 10;
}
With "ps -ax -o euid,egid,user,group,command":
EUID EGID USER GROUP COMMAND
1001 0 iday root /usr/bin/perl -w ./test
The user iday has uid 1001 and gid 1001 (groupname iday), but that
does not show up.
How can I change the process uid and gid for example like an apache
server does?
Thanks...