Using pw adduser to set password in a script

lewiz purple at lewiz.info
Mon Jun 30 23:38:41 PDT 2003


On Tue, Jul 01, 2003 at 07:12:49AM +0100, Jez Hancock wrote:
> I'm attempting to use pw adduser to add a new user to the system and
> would like confirmation that the following is the correct way to set
> the user's password at the same time:
> 
> echo "password" | \
> pw adduser -q -h - -u user -g group -s shell -d /home/user -c comment

I usually just add a user with pw, then use passwd to set a password.
That might be easier, not to mention looking (slightly) more elegant:

pw adduser -q -u user -g group -s shell -d /home/user -c comment
passwd user $passwd

> Can anyone also tell me the security implications of doing this, given
> that the command is executed from a within a script (actually php but
> this is more-or-less irrelevant)?

I don't know, but I'd check how PHP does logging -- you really want to
obfuscate your chosen method of setting the password, if it's gonna go
down in the log...

  Sorry I can't help more,

-lewiz.

-- 
"I belong to no organized party.  I am a Democrat."
		-- Will Rogers
------------------------------------------------------------------------
-| msn:purple at lewiz.net | jab:lewiz at jabber.org | url:http://lewiz.net |-
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20030701/2bdda854/attachment.bin


More information about the freebsd-questions mailing list