From owner-freebsd-stable Sun Dec 23 15:42:59 2001 Delivered-To: freebsd-stable@freebsd.org Received: from creme-brulee.marcuscom.com (rdu57-28-046.nc.rr.com [66.57.28.46]) by hub.freebsd.org (Postfix) with ESMTP id 5F64537B416 for ; Sun, 23 Dec 2001 15:42:55 -0800 (PST) Received: from shumai.marcuscom.com (marcus@shumai.marcuscom.com [192.168.1.4]) by creme-brulee.marcuscom.com (8.11.6/8.11.6) with ESMTP id fBNNg1J42673; Sun, 23 Dec 2001 18:42:01 -0500 (EST) (envelope-from marcus@marcuscom.com) Subject: Re: OT: Setting password from command line From: Joe Clarke To: Ian Chilton Cc: freebsd-stable@FreeBSD.ORG In-Reply-To: <20011223233327.B13474@woody.ichilton.co.uk> References: <20011223233327.B13474@woody.ichilton.co.uk> Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: Evolution/1.0 (Preview Release) Date: 23 Dec 2001 18:42:51 -0500 Message-Id: <1009150971.53591.6.camel@shumai.marcuscom.com> Mime-Version: 1.0 Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Sun, 2001-12-23 at 18:33, Ian Chilton wrote: > Hello, > > Sorry for another off-topic post. > > I am creating a user on the command line with: > > pw useradd myusername -g mygroup -s /sbin/nologin -c description > > I now need a way of setting the password on this account, but it must > be none-interactive as I want to call it from a Perl script. unless (open(PW, "| /usr/sbin/pw usermod $user -h 0")) { carp "Unable to open a pipe to /usr/sbin/pw."; exit 3; } print PW $newPass, "\n"; unless (close PW) { carp "/usr/sbin/pw exited on $?: $!"; exit 3; } Where $user is the username and $newPass is the user's new password. Joe > > Any ideas? > > > Thanks > > Ian > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-stable" in the body of the message > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message