Changing Passwords From A Batch File

Jonathan I. Kamens jik at athena.mit.edu
Tue Nov 13 00:39:51 AEST 1990


In article <1990Nov12.035942.14096 at sjuphil.uucp>, brunette at sjuphil.uucp (Glenn M. Brunette) writes:
|> I was wondering if it is possible to change a users password by redirecting 
|> input from a data file.  At our installation, there are about 40 temporary
|> accounts that need to exist, but because of problems that we have been having
|> with them, we would like to set up a cron that would change the password 
|> as needed.  The cron part is easy, but getting the passwd program to 
|> recognise the input redirection is what is giving us the program. Does anyone
|> have any ideas?

  Well, presumably if you're changing passwords, you've got root access to the
system.  So write your own program to edit the passwd file.  You're allowed to
do that, you're root.  If you don't know any of (a) how to encrypt a password
in a C program, (b) how to store a new password in the passwd file from a C
program, or (c) how to not open security holes while doing the testing, I'd
suggest you not do things this way.

  Alternatively, get Dan Bernstein's "pty" package from the comp.sources.unix
archives and do

  (echo new-password; echo new-password) | pty passwd username

-- 
Jonathan Kamens			              USnail:
MIT Project Athena				11 Ashford Terrace
jik at Athena.MIT.EDU				Allston, MA  02134
Office: 617-253-8085			      Home: 617-782-0710



More information about the Comp.unix.questions mailing list