From owner-freebsd-questions Sat Jul 27 3:51:48 2002 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 5167E37B400 for ; Sat, 27 Jul 2002 03:51:47 -0700 (PDT) Received: from server.rucus.ru.ac.za (server.rucus.ru.ac.za [146.231.115.1]) by mx1.FreeBSD.org (Postfix) with SMTP id 66F2C43E5E for ; Sat, 27 Jul 2002 03:51:44 -0700 (PDT) (envelope-from drs@rucus.ru.ac.za) Received: (qmail 82859 invoked from network); 27 Jul 2002 10:51:40 -0000 Received: from bashir.dsl.ru.ac.za (146.231.113.19) by server.rucus.ru.ac.za with SMTP; 27 Jul 2002 10:51:40 -0000 Received: (qmail 4814 invoked by uid 1001); 27 Jul 2002 10:51:40 -0000 Date: Sat, 27 Jul 2002 12:51:40 +0200 From: David =?iso-8859-1?Q?Sieb=F6rger?= To: C0llisi0n Cc: freebsd-questions@freebsd.org Subject: Re: adduser/useradd via the command line Message-ID: <20020727105140.GA4800@rucus.ru.ac.za> References: Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.4i 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 Sat 2002-07-27 (02:26), C0llisi0n wrote: > Here is the problem, I'd like to use adduser (or pw useradd) to add a > user and (fun part) their password via the command line and not interactive mode. This > is needed for a php script (which calls system()). pw's -h option is what you're looking for. It allows you to specify a file descriptor from which the new user's password will be read. For example, # echo foo | pw useradd test -h 0 will create a user called 'test' with password 'foo'. Though that isn't very secure: while echo is running, a 'ps -a' will show the password. It would be better to create a (non-world-readable) temporary file and pipe that in on a different descriptor: # pw useradd test -h 5 5< passwordfile I'd suggest you read the description of -h in pw(8). -- David Siebörger drs@rucus.ru.ac.za To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message