Date: Tue, 30 Aug 2011 20:41:39 +0200 From: Roland Smith <rsmith@xs4all.nl> To: Michael <mlmichael70@gmail.com> Cc: "freebsd-questions@freebsd.org" <freebsd-questions@freebsd.org> Subject: Re: random generated password Message-ID: <20110830184139.GA52397@slackbox.erewhon.net> In-Reply-To: <4E5D28E0.5050700@gmail.com> References: <4E5D28E0.5050700@gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--DocE+STaALJfprDB Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Aug 30, 2011 at 07:16:00PM +0100, Michael wrote: > Hello, >=20 > When adding a new user it is possible to assign a random generated=20 > password. But is it possible to assign a random password for already=20 > existing users? >=20 > Preferably in a non-interactive and scriptable way. Is it possible with= =20 > the base system tools? Generating a random password can be done with the openssl in the base syste= m; openssl rand -base64 9 You'd want to pipe the output of this command through tee(1) and save it in= a file. Next you pipe it to a file discriptor leading to a 'pw usermod -h 0'. Something like this: openssl rand -base64 9 | tee -a newpasswords | pw usermod UID -h 0 where UID is the user-id or name of the user in question. Roland --=20 R.F.Smith http://www.xs4all.nl/~rsmith/ [plain text _non-HTML_ PGP/GnuPG encrypted/signed email much appreciated] pgp: 1A2B 477F 9970 BA3C 2914 B7CE 1277 EFB0 C321 A725 (KeyID: C321A725) --DocE+STaALJfprDB Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) iEYEARECAAYFAk5dLuIACgkQEnfvsMMhpyWoegCffcHKQEgzzTwIL3uFPAh5zDii wzAAn17rhvaWmO40TNJ9iQfKJ+wVK5W4 =N9ir -----END PGP SIGNATURE----- --DocE+STaALJfprDB--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110830184139.GA52397>