Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 Aug 1999 11:45:17 -0500
From:      beemern@ksu.edu
To:        "Francis A. Vidal" <francis@usls.edu>
Cc:        FreeBSD Questions <freebsd-questions@FreeBSD.ORG>
Subject:   Re: pw useradd -h option
Message-ID:  <37C56F1D.BCD9ACB6@ksu.edu>
References:  <Pine.LNX.4.10.9908270022001.15703-100000@atlas.usls.edu>

next in thread | previous in thread | raw e-mail | index | archive | help

"Francis A. Vidal" wrote:

> how do i change their password non-interactively? BTW, is it normal for
> the UID to have the same value if the -N option is used during the entire
> lifetime of the script?
>

as far as changing user passwords automatically, as in, through a script
without user input, i'd use a the expect scripting language.  i've used it
in the past for this type of situation and it works great
here is a sample script that i've used to show you how it works in basic
form... obviously for more info you can research expect.  its also in the
ports tree.

--snip--
spawn passwd USERNAME

expect "New UNIX password:"
send "newpassword\r"
expect "Retype new UNIX password:"
send "newpassword\r"
interact
--snip--

hope this helps!
good luck



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?37C56F1D.BCD9ACB6>