Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 8 Jun 2001 19:13:04 +0200
From:      Gerhard Sittig <Gerhard.Sittig@gmx.net>
To:        freebsd-security@FreeBSD.ORG
Subject:   Re: Encrypted passwords
Message-ID:  <20010608191304.N17514@speedy.gsinet>
In-Reply-To: <Pine.BSF.4.30_heb2.09.0106071629460.65521-100000@slis-two.lis.fsu.edu>; from david@slis-two.lis.fsu.edu on Thu, Jun 07, 2001 at 04:33:38PM -0400
References:  <20010607220227.W59617@mail.webmonster.de> <Pine.BSF.4.30_heb2.09.0106071629460.65521-100000@slis-two.lis.fsu.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Jun 07, 2001 at 16:33 -0400, David Miner wrote:
> On Thu, 7 Jun 2001, Karsten W. Rohrbach wrote:
> 
> > correct me if i am just stupid, but i don't get the point
> >   echo -n passW0Rd | pw -u testuser -h 1
> > sets the password of "testuser" to "passW0Rd", soring it in
> > the auth system you prefer in encrypted form. am i missing
> > something?
> >
> > /k
> >
> No, I don't think you have missed the point.  Using echo and
> piping it into pw would work.  I am trying read the cleartext
> password from a file and, since I haven't figured out how the
> pw file descriptor works, encrypt it and use the chpass utility
> to get it into /etc/passwd.

Why are you trying to do this manually?  It's as simple as

  echo "$PASSWORD" | pw usermod -n $USERNAME -h 0

(this is exactly what you can read in "man pw").  There shouldn't
be much of a problem in any scripting language to pipe the
cleartext password into the pw(8) command after creating the user
(or during creating it, but I didn't test this -- while changing
an existing user's password went fine here, as well as disabling
it by means of "-h -").

> It looks like it encrypts correctly, but the user cannot log in
> with that password.  So something must be wrong with the
> encryption system or the way I have put the pieces together.

The problem probably is that you want to reinvent existing
functionality. :)  Just use what's at your hands!


virtually yours   82D1 9B9C 01DC 4FB4 D7B4  61BE 3F49 4F77 72DE DA76
Gerhard Sittig   true | mail -s "get gpg key" Gerhard.Sittig@gmx.net
-- 
     If you don't understand or are scared by any of the above
             ask your parents or an adult to help you.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-security" in the body of the message




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