Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 12 Sep 2003 17:10:52 +0100
From:      Matthew Seaman <m.seaman@infracaninophile.co.uk>
To:        thomas may <thomas.may@x9media.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: passwort create with perl
Message-ID:  <20030912161052.GC50239@happy-idiot-talk.infracaninophile.co.uk>
In-Reply-To: <000001c37928$825eced0$8b01a8c0@notebook>
References:  <000001c37928$825eced0$8b01a8c0@notebook>

next in thread | previous in thread | raw e-mail | index | archive | help

--ALfTUftag+2gvp1h
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Fri, Sep 12, 2003 at 02:22:11PM +0200, thomas may wrote:

> iam searching for a perl programm to create an freebsd user account
> password, i dont want to change a password, i want to see it on the
> command line, to copy and paste it into another application.

You want to input the password to the perl program and get from it the
password hash as stored in /etc/master.passwd?  This will generate you
the MD5 hash:

   #!/usr/bin/perl -w

   @pwchars =3D ('a' .. 'z', 'A' .. 'Z', '0' .. '9', '/', '.');

   $salt =3D '$1$';
   for (1 .. 8) {
     $salt .=3D $pwchars[rand @pwchars];
   }
   $salt .=3D '$';

   print crypt($ARGV[0], $salt), "\n";

	Cheers,

	Matthew

--=20
Dr Matthew J Seaman MA, D.Phil.                       26 The Paddocks
                                                      Savill Way
PGP: http://www.infracaninophile.co.uk/pgpkey         Marlow
Tel: +44 1628 476614                                  Bucks., SL7 1TH UK

--ALfTUftag+2gvp1h
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (FreeBSD)

iD8DBQE/YfAMdtESqEQa7a0RAl0OAJ9A+1hww/HgJFjREIWjC0DbC6uAtwCfc//d
COVNaLcOS848Hvl+0knffl8=
=G09l
-----END PGP SIGNATURE-----

--ALfTUftag+2gvp1h--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030912161052.GC50239>