From owner-freebsd-questions@FreeBSD.ORG Wed Mar 17 22:50:06 2010 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 93B03106566B for ; Wed, 17 Mar 2010 22:50:06 +0000 (UTC) (envelope-from rsmith@xs4all.nl) Received: from smtp-vbr5.xs4all.nl (smtp-vbr5.xs4all.nl [194.109.24.25]) by mx1.freebsd.org (Postfix) with ESMTP id 286D28FC1F for ; Wed, 17 Mar 2010 22:50:05 +0000 (UTC) Received: from slackbox.erewhon.net (slackbox.xs4all.nl [213.84.242.160]) by smtp-vbr5.xs4all.nl (8.13.8/8.13.8) with ESMTP id o2HMo4OD007603; Wed, 17 Mar 2010 23:50:04 +0100 (CET) (envelope-from rsmith@xs4all.nl) Received: by slackbox.erewhon.net (Postfix, from userid 1001) id 89E4EBAB5; Wed, 17 Mar 2010 23:50:04 +0100 (CET) Date: Wed, 17 Mar 2010 23:50:04 +0100 From: Roland Smith To: Peter Steele Message-ID: <20100317225004.GA16533@slackbox.erewhon.net> References: <7B9397B189EB6E46A5EE7B4C8A4BB7CB3B27DFDA@MBX03.exg5.exghost.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="UugvWAfsgieZRqgk" Content-Disposition: inline In-Reply-To: <7B9397B189EB6E46A5EE7B4C8A4BB7CB3B27DFDA@MBX03.exg5.exghost.com> X-GPG-Fingerprint: 1A2B 477F 9970 BA3C 2914 B7CE 1277 EFB0 C321 A725 X-GPG-Key: http://www.xs4all.nl/~rsmith/pubkey.txt X-GPG-Notice: If this message is not signed, don't assume I sent it! User-Agent: Mutt/1.5.20 (2009-06-14) X-Virus-Scanned: by XS4ALL Virus Scanner Cc: "freebsd-questions@freebsd.org" Subject: Re: Generating a random hostname X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2010 22:50:06 -0000 --UugvWAfsgieZRqgk Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Mar 17, 2010 at 05:06:30PM -0500, Peter Steele wrote: > Is there any facility in FreeBSD for generating a random hostname? We hav= e a > template with a fixed hostname that has to be changed after the template = is > closed. It would be useful to have a hostname generated randomly. For random strings, I tend to use openssl (e.g. with base64 encoding); openssl rand -base64 18 You do run the risk here of getting non-alphabetic characters here, so you might want to filter those: openssl rand -base64 18| sed 's|[^[:alpha:]]||g' Or if you are fine with just hex numbers; openssl rand 18 | hexdump -e '8 "%X" "\n"' 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) --UugvWAfsgieZRqgk Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAkuhXJwACgkQEnfvsMMhpyWPzgCcCGOM6PfzesFLhVtTbIK4Wtx4 zqQAn2GcQdQm++FlQVRuxkn/3bPLlGC3 =T7xO -----END PGP SIGNATURE----- --UugvWAfsgieZRqgk--