From owner-freebsd-questions Tue Sep 17 6:10:42 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 9CC9937B401 for ; Tue, 17 Sep 2002 06:10:39 -0700 (PDT) Received: from smtp.mailbox.net.uk (smtp.mailbox.co.uk [195.82.125.32]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4E8AF43E42 for ; Tue, 17 Sep 2002 06:10:38 -0700 (PDT) (envelope-from m.hill@stjamessengirls.org.uk) Received: from [212.18.235.141] (helo=SJMOBILE11) by smtp.mailbox.net.uk with smtp (Exim 3.36 #1) id 17rI7e-0003ir-00; Tue, 17 Sep 2002 14:10:34 +0100 Message-ID: <000801c25e4b$9de78870$0b00000a@SJMOBILE11> From: "Martyn Hill" To: "Matthew Seaman" Cc: "FreeBSD-questions" References: <000701c25bf5$2d8fa920$f801000a@maya.net> <20020914150451.GA48316@happy-idiot-talk.infracaninophi> Subject: Re: How do I use the -h option in PW to set passwords fo rnew users Date: Tue, 17 Sep 2002 14:10:38 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4807.1700 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 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 Matthew Thanks very much for your reply. It seems to work OK. I'm still not sure what requirements Samba places on the Unix users' password when a Samba user is first created. It could be that the -h - option in PW (set password to *) will work - I can then script Samba password changes from within Samba itself (slightly off topic, sorry.) Cheers. Martyn Hill ICT Teacher and IT Co-ordinator St James Independent School London ----- Original Message ----- From: "Matthew Seaman" To: "Martyn Hill" Cc: "Questions FreeBSD" Sent: Saturday, September 14, 2002 4:04 PM Subject: Re: How do I use the -h option in PW to set passwords fo rnew users > On Sat, Sep 14, 2002 at 02:46:50PM +0100, Martyn Hill wrote: > > I need to set-up about 200 user accounts under FreeBSD 4.5-RELEASE for the > > school pupil and staff population. We run Samba-TNG to share files, but need > > to create the UNIX users first. I intend to run a simple script to create > > the users with a pre-prepared password. > > > > I've looked at PW but can't understand how the -h option is supposed to work > > for setting initial passwords for new users. How do I specify the "file > > descriptor" as described in the man page? > > > > I've tried creating a file containing the password and specifying: > > > > pw adduser ... -h /path_to_file_containing_users_password > > > > You can use bourne shell to do that very easily: > > % echo "foobar" > /tmp/pass > % su root -c sh > Password: > # pw useradd -n test -c "Test User" -m -h 3 3< /tmp/pass > # grep test /etc/master.passwd > test:$1$T2tu0BET$UGPrNB1FavzjlzhTwUWRN.:1002:1002::0:0:Test User:/home/test:/bin/sh > # exit > % su test > Password: [typed "foobar" here...] > $ exit > > The crucial bit is the '3<' construct: see the section on > "Redirections" in the sh(1) man page for details --- bash(1), ksh(1), > zsh(1) etc all support a similar mechanism, but csh(1) and tcsh(1) > don't. > > You should probably use a file descriptor greater than 2 for this, as > fd's 0, 1, 2 usually correspond to stdin, stdout and stderr > respectively. > > Cheers, > > Matthew > > > -- > Dr Matthew J Seaman MA, D.Phil. 26 The Paddocks > Savill Way > Marlow > Tel: +44 1628 476614 Bucks., SL7 1TH UK > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message