Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 Aug 1999 19:44:26 +0100
From:      Ben Smithurst <ben@scientia.demon.co.uk>
To:        "Francis A. Vidal" <francis@usls.edu>
Cc:        FreeBSD Questions <freebsd-questions@freebsd.org>
Subject:   Re: pw useradd -h option
Message-ID:  <19990826194426.A2945@lithium.scientia.demon.co.uk>
In-Reply-To: <Pine.LNX.4.10.9908270022001.15703-100000@atlas.usls.edu>
References:  <Pine.LNX.4.10.9908270022001.15703-100000@atlas.usls.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
Francis A. Vidal wrote:

> can someone show me how to implement the `-h' option in a script? i'm
> currently testing this script:
> 
> #!/bin/sh
> #
> while read username first middle last password
> do
>     fullname="$first $middle. $last"
>     ...
>     /usr/sbin/pw useradd $username -k /usr/share/uskel -s /sbin/nologin \
>         -d $homedir -c $fullname -m
> done
> 
> how do i change their password non-interactively?

echo $password | /usr/sbin/pw useradd $username -h 0

plus the other args after the -h 0, as in your script above.

> BTW, is it normal for the UID to have the same value if the -N option
> is used during the entire lifetime of the script?

Yes, looking at the manual, I would assume so. Since you're not specifying
a UID, and you're not updating the password database when you use -N, the
same UID will be used every time.

-- 
Ben Smithurst            | PGP: 0x99392F7D
ben@scientia.demon.co.uk |   key available from keyservers and
                         |   ben+pgp@scientia.demon.co.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?19990826194426.A2945>