🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: ch.comp.os.linux
Article #24697

Re: wie passwd aus pipe oder batch maessig aendern?

#24697
From: Olivier M.
Date: Fri, 29 Jan 1999 00:00
32 lines
1599 bytes
<me@ieo.ch> ecrivait/schrieb/wrote:
>Hi ...
>
>gibts beim passwd ein parm mit dem ich aus einem script .. z.b. perl das 
>passwort fuer user aendern kann .. man passwd hat nichts gezeigt .. und 
>das normale pw ist ned so gut ... in nem batch muesste ich das pw einfach 
>einmal eingeben koennen und gut ist ...

try something like this :

use Expect;
$Expect::Log_Stdout=0; # On by default.

($chpw = Expect->spawn("/usr/bin/passwd")) || &error("passwd pb 0 ?");
$chpw->expect(10, "ssword:") ||  &error("passwd problem ?\n");
print $chpw $password . "\n";
$chpw->expect(10, "ssword:") ||  &error("passwd problem2 ?\n");
print $chpw $newpass1 . "\n";
$chpw->expect(10, "ssword:") ||  &error("passwd problem3 ?\n");
print $chpw $newpass2 . "\n\n\n";
#$msg = $chpw->exp_before();
$chpw->soft_close();

Kann sicher schoener geschrieben werden, aber bei mir lauft es, also... :)

Olivier


-- 
____________________________________________________________
 ... Please replace "XW*SXD" by "olm" to answer by e-mail...
    --- .-.. .. ...- .. . .-.    -- ..- .-.. .-.. . .-.
Technical Details
Message-ID: <slrn7b44nd.gop.XW*SXD@tardis-a31.ee.ethz.ch>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <MPG.111c04f9266fbf6c9896d0@news.sunrise.ch>

Show Full Headers
Complete Article Headers
X-Google-Language: GERMAN,ASCII-7-bit
X-Google-Thread: f4b73,4cec88869faccdbc
X-Google-Attributes: gidf4b73,public
From: XW*SXD@technologist.com (Olivier M.)
Subject: Re: wie passwd aus pipe oder batch maessig aendern?
Date: 1999/01/29
Message-ID: <slrn7b44nd.gop.XW*SXD@tardis-a31.ee.ethz.ch>
X-Deja-AN: 438450538
References: <MPG.111c04f9266fbf6c9896d0@news.sunrise.ch>
X-Trace: 29 Jan 1999 20:58:38 +0100, tardis-a31.ee.ethz.ch
Organization: ETH Zurich
Newsgroups: ch.comp.os.linux