From owner-freebsd-questions Sun Dec 7 15:36:19 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id PAA03591 for questions-outgoing; Sun, 7 Dec 1997 15:36:19 -0800 (PST) (envelope-from owner-freebsd-questions) Received: from ocala.cs.miami.edu (ocala.cs.miami.edu [129.171.34.17]) by hub.freebsd.org (8.8.7/8.8.7) with SMTP id PAA03580 for ; Sun, 7 Dec 1997 15:36:16 -0800 (PST) (envelope-from jmcla@ocala.cs.miami.edu) Received: from ocala.cs.miami.edu by ocala.cs.miami.edu via SMTP (950413.SGI.8.6.12/940406.SGI) id SAA14648; Sun, 7 Dec 1997 18:36:03 -0500 Date: Sun, 7 Dec 1997 18:36:03 -0500 (EST) From: "Joe \"Marcus\" Clarke" Reply-To: "Joe \"Marcus\" Clarke" To: Bill Sandiford cc: FreeBSD Questions mail list Subject: Re: Change Password Script In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk I'm not really sure what uid will be running this script, but from the sounds of it, it will be root. So, use Perl to edit /etc/master.passwd. It's a plain text file. Perl has a crypt routine that accepts a string and a salt, and returns the encrypted version. Use that to encrypt the password, then write it out to /etc/master.passwd. When you're done, run pwd_mkdb /etc/master.passwd to get the password change to work. Joe Clarke On Sat, 6 Dec 1997, Bill Sandiford wrote: > I need some help > > I need to write a script that will change a users script from the command > line. The format would be something like : > > change_pass username newpassword > > > Problem is that I can't find a way to pass the variables to passwd and > have them go in correctly. Someone suggested before that I use pw to feed > in the password, but I can't figure that out either. I was also told that > writing a script to do this could be vulnerable because someone could type > ps and read the password. This doesn't matter to me, as my box is secure > and noone can get access to a shell. > > Thanks in advance > > Bill Sandiford > >