Date: 23 Dec 2001 18:42:51 -0500 From: Joe Clarke <marcus@marcuscom.com> To: Ian Chilton <ian@ichilton.co.uk> Cc: freebsd-stable@FreeBSD.ORG Subject: Re: OT: Setting password from command line Message-ID: <1009150971.53591.6.camel@shumai.marcuscom.com> In-Reply-To: <20011223233327.B13474@woody.ichilton.co.uk> References: <20011223233327.B13474@woody.ichilton.co.uk>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 2001-12-23 at 18:33, Ian Chilton wrote:
> Hello,
>
> Sorry for another off-topic post.
>
> I am creating a user on the command line with:
>
> pw useradd myusername -g mygroup -s /sbin/nologin -c description
>
> I now need a way of setting the password on this account, but it must
> be none-interactive as I want to call it from a Perl script.
unless (open(PW, "| /usr/sbin/pw usermod $user -h 0")) {
carp "Unable to open a pipe to /usr/sbin/pw.";
exit 3;
}
print PW $newPass, "\n";
unless (close PW) {
carp "/usr/sbin/pw exited on $?: $!";
exit 3;
}
Where $user is the username and $newPass is the user's new password.
Joe
>
> Any ideas?
>
>
> Thanks
>
> Ian
>
>
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-stable" in the body of the message
>
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1009150971.53591.6.camel>
