Re: lug-bg: passwd i chfn prez web?
- Subject: Re: lug-bg: passwd i chfn prez web?
- From: Peter Pentchev <roam@xxxxxxxxxxx>
- Date: Tue, 1 Jun 2004 17:58:45 +0300
On Tue, Jun 01, 2004 at 05:40:14PM +0300, Vasil Kolev wrote:
> На вт, 2004-06-01 в 17:26, Peter Pentchev записа:
>
> > drug_account ALL=(root) NOPASSWD: /usr/bin/chfn, /usr/bin/passwd
>
> Не /usr/bin/passwd, а /usr/sbin/chpasswd , първото е направо
> неизползваемо от автоматични скриптове.
Мммкей... имаш право, поне за случаите, когато наистина има chpasswd.
<clickety-click> Яяя, и под FreeBSD не мога да ползвам passwd за тази
цел, поне с printf 'blah\nblah\n' | sudo passwd tanj не стана...
Под FreeBSD това всъщност се пише като:
echo blah | /usr/local/bin/sudo /usr/sbin/pw usermod tanj -h 0
..или, разбира се, нещо като:
open(PW, "| /usr/local/bin/sudo /usr/sbin/pw usermod tanj -h 0");
print PW "blah\n";
close(PW);
..или по-добре (untested):
if (!defined($pid = open("|-")) {
die("fork: $!\n");
} elsif ($pid == 0) {
exec('/usr/local/bin/sudo', '/usr/sbin/pw', 'usermod', $username,
'-h', '0');
die("exec(pw): $!");
}
print PW "blah\n";
close(PW);
Поздрави,
Петър
--
Peter Pentchev roam@xxxxxxxxxxx roam@xxxxxxxx roam@xxxxxxxxxxx
PGP key: http://people.FreeBSD.org/~roam/roam.key.asc
Key fingerprint FDBA FD79 C26F 3C51 C95E DF9E ED18 B68D 1619 4553
You have, of course, just begun reading the sentence that you have just finished reading.
Attachment:
pgpQAboL3NDfY.pgp
Description: PGP signature
|