From owner-freebsd-questions Sat Dec 29 1:49:26 2001 Delivered-To: freebsd-questions@freebsd.org Received: from swan.prod.itd.earthlink.net (swan.mail.pas.earthlink.net [207.217.120.123]) by hub.freebsd.org (Postfix) with ESMTP id 7B16D37B41C for ; Sat, 29 Dec 2001 01:49:24 -0800 (PST) Received: from dialup-209.245.140.30.dial1.sanjose1.level3.net ([209.245.140.30] helo=blossom.cjclark.org) by swan.prod.itd.earthlink.net with esmtp (Exim 3.33 #1) id 16KG7E-0006Sf-00; Sat, 29 Dec 2001 01:49:22 -0800 Received: (from cjc@localhost) by blossom.cjclark.org (8.11.6/8.11.3) id fBT9mqU96290; Sat, 29 Dec 2001 01:48:52 -0800 (PST) (envelope-from cjc) Date: Sat, 29 Dec 2001 01:48:51 -0800 From: "Crist J . Clark" To: ScaryG Cc: FreeBSD Questions Subject: Re: adduser in a perl script question Message-ID: <20011229014851.H93411@blossom.cjclark.org> References: <20011228101438.187f0eb0.freymann@scaryg.shacknet.nu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20011228101438.187f0eb0.freymann@scaryg.shacknet.nu>; from freymann@scaryg.shacknet.nu on Fri, Dec 28, 2001 at 10:14:38AM -0500 X-URL: http://people.freebsd.org/~cjc/ Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Fri, Dec 28, 2001 at 10:14:38AM -0500, ScaryG wrote: > Hi Gang. > > I'm trying to automate the creation of a new user in a perl5 script. > > The following does not work: > > $error = `/usr/sbin/adduser -shell $shell -fullname $name -password > $password -username $username -home /home/$name`; Nope. There are a lot of options used there that don't exist. > This runs as root and the variables are populated in advance. > > I've read the man(8) page for adduser but it's not helping. adduser(8) is intended for interactive use, not in scripts... > I need to set > the password which is why I'm not using pw. pw(8) is the tool to use for scripts. > The man pages for pw talk > about a pipe for the password but there are no examples. > > I'm hoping somebody else out there can toss me a pointer or two to make > this work? As someone else pointed out, # echo "$password" | pw add user "$username" -h 0 Is a trivial example. -- "It's always funny until someone gets hurt. Then it's hilarious." Crist J. Clark | cjclark@alum.mit.edu | cjclark@jhu.edu http://people.freebsd.org/~cjc/ | cjc@freebsd.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message