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" <[EMAIL PROTECTED]> To: "Martyn Hill" <[EMAIL PROTECTED]> Cc: "Questions FreeBSD" <[EMAIL PROTECTED]> 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 [EMAIL PROTECTED] with "unsubscribe freebsd-questions" in the body of the message