Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 17 Sep 2002 14:10:38 +0100
From:      "Martyn Hill" <m.hill@stjamessengirls.org.uk>
To:        "Matthew Seaman" <m.seaman@infracaninophile.co.uk>
Cc:        "FreeBSD-questions" <freebsd-questions@freebsd.org>
Subject:   Re: How do I use the -h option in PW to set passwords fo rnew users
Message-ID:  <000801c25e4b$9de78870$0b00000a@SJMOBILE11>
References:  <000701c25bf5$2d8fa920$f801000a@maya.net> <20020914150451.GA48316@happy-idiot-talk.infracaninophi>

next in thread | previous in thread | raw e-mail | index | archive | help
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" <m.seaman@infracaninophile.co.uk>
To: "Martyn Hill" <m.hill@st-james-snrgirls.w-london.sch.uk>
Cc: "Questions FreeBSD" <questions@FreeBSD.ORG>
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?000801c25e4b$9de78870$0b00000a>