Date: Sat, 27 Jul 2002 12:51:40 +0200 From: David =?iso-8859-1?Q?Sieb=F6rger?= <drs@rucus.ru.ac.za> To: C0llisi0n <epsilon@ircd2.lomag.net> Cc: freebsd-questions@freebsd.org Subject: Re: adduser/useradd via the command line Message-ID: <20020727105140.GA4800@rucus.ru.ac.za> In-Reply-To: <Pine.BSF.4.44.0207270220100.21681-100000@ircd2.lomag.net> References: <Pine.BSF.4.44.0207270220100.21681-100000@ircd2.lomag.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sat 2002-07-27 (02:26), C0llisi0n wrote: > Here is the problem, I'd like to use adduser (or pw useradd) to add a > user and (fun part) their password via the command line and not interactive mode. This > is needed for a php script (which calls system()). pw's -h option is what you're looking for. It allows you to specify a file descriptor from which the new user's password will be read. For example, # echo foo | pw useradd test -h 0 will create a user called 'test' with password 'foo'. Though that isn't very secure: while echo is running, a 'ps -a' will show the password. It would be better to create a (non-world-readable) temporary file and pipe that in on a different descriptor: # pw useradd test -h 5 5< passwordfile I'd suggest you read the description of -h in pw(8). -- David Siebörger drs@rucus.ru.ac.za 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?20020727105140.GA4800>