From owner-freebsd-questions@FreeBSD.ORG Thu Apr 29 13:01:22 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 185D616A4CE for ; Thu, 29 Apr 2004 13:01:22 -0700 (PDT) Received: from internet.potentialtech.com (h-66-167-251-6.phlapafg.covad.net [66.167.251.6]) by mx1.FreeBSD.org (Postfix) with ESMTP id E310043D49 for ; Thu, 29 Apr 2004 13:01:21 -0700 (PDT) (envelope-from wmoran@potentialtech.com) Received: from potentialtech.com (pa-plum1c-102.pit.adelphia.net [24.53.179.102]) by internet.potentialtech.com (Postfix) with ESMTP id BC4B469A81 for ; Thu, 29 Apr 2004 16:01:19 -0400 (EDT) Message-ID: <40915E84.9040106@potentialtech.com> Date: Thu, 29 Apr 2004 15:59:00 -0400 From: Bill Moran User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.6) Gecko/20040422 X-Accept-Language: en-us, en MIME-Version: 1.0 To: freebsd-questions@FreeBSD.org References: <20040424232033.GA53918@keyslapper.org> <20040424184957.I57098@sotec.home> <20040429193544.GH419@keyslapper.org> In-Reply-To: <20040429193544.GH419@keyslapper.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: non-interactive password X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Apr 2004 20:01:22 -0000 Louis LeBlanc wrote: > On 04/24/04 06:52 PM, Mikko Työläjärvi sat at the `puter and typed: > >>On Sat, 24 Apr 2004, Louis LeBlanc wrote: >> >>>Hey everyone. I'm trying to recreate a password script that sets >>>passwords (as root on the local system only). The trick is that it >>>must change the password non-interactively. I had this working, but >>>when the system was trashed, the script was lost. >>> >>>Can someone refresh my memory on the command format? >> >> echo "$password" | pw usermod "$user" -h0 >> >>Might do the trick. > > 'fraid not. It fails quietly, but it fails. > > Thanks anyway. The man page for pw says that pw needs a file descriptor to set the password via -h I'm not 100% sure, but I seem to remember that most shells provide a sort of "heredoc" support for this. Such that: pw usermod "$user" -h <<