How can I pipe input into passwd?
danl at midget.towson.edu
danl at midget.towson.edu
Mon Aug 28 23:25:59 AEST 1989
>I've been doing OK so far, but I'm stumped on one thing. Each quarter I
>have to generate 500 user IDs for students. I build a script that
>does this (by piping into sysadm) from student registration data from
>our administrative mainframe (Unisys A5).
>
>THE PROBLEM! How can I easily enter passwords for each account auto-
>magically. I can't pipe into passwd cause he goes after /dev/tty. I'd
>use makekey, but Prime (in their infinite wisdom) doesn't include it
>with their unix (or crypt).
>
>Ken Weaverling
>Delaware Technical & Community College
>+1 302 573 5460
I have the same problem more or less. You can't pipe to passwd because it
flushes the buffer before reading.
I solved it by writing a C program to do the complete generation of user
accounts - creation of the directory, password file entry, null mailbox,
and copying of a skeleton .login, .cshrc, and .profile. The trick with the
password is with the crypt() function. I assume from your message that you
are missing the crypt command and not the crypt function. The password field
of the password entry is generated via crypt(). I generate random passwords,
and random two character salts for the crypt function, and feed crypt()
these salts and a random password. The returned string is the password
field of the password entry. A log is generated containing the user names
and passwords for distribution to classes.
The program is four years old and needs some cleaning up (I've learned much
since then), but it still works. Anyone who wants it, let me know and i'll
send you a copy. If I get enough response, I'll make it available via ftp
and VMSserv (BITNET).
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dan Gosner Internet: danl at midget.towson.edu
Operations Manager DGosner at TOE.TOWSON.EDU
Towson State University Bitnet: DGosner at TOWSONVX
Towson, Maryland 21204
%% VMS pays the bills, but Unix is where my real work gets done. %%
***************************************************************************
More information about the Comp.unix.questions
mailing list