*BSD News Article 69263


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!news.rmit.EDU.AU!news.unimelb.EDU.AU!munnari.OZ.AU!news.ecn.uoknor.edu!news.wildstar.net!news.sdsmt.edu!nntp.uac.net!news.tufts.edu!blanket.mitre.org!news.mathworks.com!tank.news.pipex.net!pipex!dispatch.news.demon.net!demon!jraynard.demon.co.uk!not-for-mail
From: james@jraynard.demon.co.uk (James Raynard)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: Problem with CHPASS?
Date: 23 May 1996 21:44:33 -0000
Organization: A FreeBSD Box
Lines: 40
Message-ID: <4o2m81$4l1@jraynard.demon.co.uk>
References: <dhawkDr57Ko.LJ5@netcom.com> <319b67b4.5860692@news.aei.ca> <31A12443.4A86@tassie.net.au>
NNTP-Posting-Host: localhost.demon.co.uk
X-NNTP-Posting-Host: jraynard.demon.co.uk

In article <31A12443.4A86@tassie.net.au>,
Brook Schofield  <Brook@tassie.net.au> wrote:
>
>chpass -p $1$thotuh$htnhut brook
>
>but the password isn't being changed!!!
>
>If there is anyone that knows why this is happening... 

Yep, $ is a shell metacharacter (a magic symbol in plain English) and
the shell is trying to interpret it. Put single quotes around the
password:-

chpass -p '$1$thotuh$htnhut' brook

to make the shell ignore it.

>or an easy way to update the master.password file easily... or
especially in Perl.

I've just looked at the source, and it's not that straightforward - at
least not if you take stuff like YP/NIS into account.

If you have a steady hand, and you don't mind using vi, 'vipw' is
slightly more comfortable than using chpass, as you can do all sorts
of things like search-and-replace-by-regexp.

Generating passwords in Perl is easy:-

perl -e 'print crypt("foobar", "123");'

(again you need quotes, this time because of the brackets).

I'd recommend choosing a slightly less obvious salt and password,
though. 8-)

-- 
James Raynard, Edinburgh, Scotland
jraynard@dial.pipex.com
james@jraynard.demon.co.uk