From owner-freebsd-questions Fri Jun 16 14:40:26 2000 Delivered-To: freebsd-questions@freebsd.org Received: from lvdi.net (Mta.lvdi.net [216.24.138.2]) by hub.freebsd.org (Postfix) with SMTP id 6286F37B907 for ; Fri, 16 Jun 2000 14:40:22 -0700 (PDT) (envelope-from notme@lvdi.net) Received: from lvdi.net ([216.24.141.131]) by lvdi.net ; Fri, 16 Jun 2000 14:43:31 2000 PDT Message-ID: <394A9EC6.92EA0C0C@lvdi.net> Date: Fri, 16 Jun 2000 14:40:22 -0700 From: Frankie Li X-Mailer: Mozilla 4.72 [en] (Win98; I) X-Accept-Language: en,pdf MIME-Version: 1.0 To: Gabriel Ambuehl Cc: freebsd-questions Subject: Re: How can I have pw to either generate random passwords or let me define them through CLI? References: <539645219.20000616204253@buz.ch> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG I have found a way (although I'm not sure if this is the best and most secured way) to have the password supplied from command line. (and even from a text file, but I don't think that's too secured though) Although the man page states that a file descriptor is needed, all I did was just open an empty file, and use it as a file descriptor. However, I am not sure if there is any side effect. here's an example touch tempfile (the following should be one line, but it couldn't fit within 70 characters.) echo password | pw useradd someuser -d /usr/home/cs1p1/someuser -e 6/30/2000 -m -g cs1p1 -h tempfile password contains your password, possibly from command line or from a file read by a shell script, and someuser is the username. cs1p1 is just a group that I use for school. -h seems to allow me to use an empty file as a file descriptor, and afterward, nothing is written in it. Well, it works ;) I believe -w random will generate a random password, but it prints passwords out in stdout, and I have no experience with it. I hope this helps. Frankie Gabriel Ambuehl wrote: > > Hello, > I'm trying to use pw in an account setup script but I've got a problem > with it, it doesn't seem to accept neither commandline supplied > passwords nor the random generation of those. The man page states that > there's a filedescriptor interface but I'd prefer to not mess with > that stuff if possible in anyway. Any ideas would be greatly > appreciated. > > Best regards, > Gabriel > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-questions" in the body of the message To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message