SUMMARY: Setting initial passwords

From: Martin Rootes (
Date: Fri Jul 24 1992 - 20:14:22 CDT

Dear All,

    Thanks for the numerous replies to my question, I have been attempting to
prepare a more detailed summary, but messages keep arriving. So I have decided
to send a brief summary now mainly to say WOAH STOP!. I'll prepare a more
detailed summary on Monday. Anyway the question was.

> Dear All,
> I'm currently writing a script to add users to our Sun 670 (SunOS 4.1.2)
> NIS master server. What I want to be able to do is to set the inital password
> at the same time to a randomly generated 6 letter password. I have writen a
> small C program to generate these passwords, but have now struck a problem,
> namely that I can not set the password by piping the output of this program
> into either passwd or ypasswd.
> How can I set initial passwords, at present I'm only adding single users
> so I can manually change the passwords, but in the near future I will be
> adding codes for students, which will involve adding 30-100 codes at a time.
> Martin
The following people have responded so far (the next postin will hopefully
contain a full list):

Brent Chivers
Brett Lymn
Chris Keane chris@rufus.state.COM.AU *
Colin Eagle
Colin Macleod
Daniel Baldoni
Dave Mitchell *
David Lee
Eckhard Rueggeberg
Ed Arnold era@niwot.scd.ucar.EDU
Geert Jan
James Ashton
Jim Davidson *
Joseph "C." Konczal
Kes Masalaitas kes@gvlf6.GVL.Unisys.COM
Marcel Bernards bernards@ECN.NL
Meg Grice
Michael Hwa
Mike Raffety
Peter Shipley shipley@tfs.COM
Steve Simmons scs@lokkur.UUCP
Torsten Metzner *

The answers fell into 5 different methods:-

   1. Use a pacakge called expect, this can send commands to an interactive
      program and then react depending on the reply.

   2. Use perl to generate an encrypted password (perl has this function built
      in), then update passwd file directly.

   3. Use crypt to generate an encrypted version of the password and update the
      passwd file directly. This is the method I've chosen, adapting the random
      password generating program to also output the encrypted password.

   4. Use pty or rsh by piping the password twice to pty/rsh which then runs

   5. Modify the source code to passwd.

If anyone can think of any OTHER method between now and Monday then feel free
to send it otherwise, if not then I have enough to go on already.



Martin Rootes - Senior Systems Programmer/Analyst - Sheffield City Polytechnic
Email :
Disclaimer: Sheffield City Polytechnic has no opinions, the ones above are

This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:06:45 CDT