[sudo-users] Problem with 'sudo' ignoring switches
Todd C. Miller
Todd.Miller at courtesan.com
Fri Jul 29 21:14:43 EDT 2005
Personally, I would do it like this:
system("sudo -K");
...
$pid = open(SUDO, "|-");
if (!defined($pid)) {
die "$0: can't fork: $!\n";
} elsif ($pid) {
print SUDO "$passwd\n";
close(SUDO);
} else {
exec("sudo", "-S", "-v", "-p", $say_sudo);
}
That way $say_sudo can contain whitespace without worrying about
quoting issues.
- todd
More information about the sudo-users
mailing list