[comp.unix.internals] passwd

ITMS400@indycms.iupui.edu ( Manjit Trehan) (09/25/90)

Is there any way to have the adduser program set passwords from a
file.  It seems to not use stdin to read the password, rather,
opens the tty device to read the password (??).

thanks,

mst.

bhoughto@cmdnfs.intel.com (Blair P. Houghton) (09/26/90)

In article <24596@adm.BRL.MIL> ITMS400@indycms.iupui.edu ( Manjit Trehan) writes:
>
>Is there any way to have the adduser program set passwords from a
>file.  It seems to not use stdin to read the password, rather,
>opens the tty device to read the password (??).

On most systems you'd use makekey(3).

				--Blair
				  "Most."

konczal@sunmgr.ncsl.nist.gov (Joe Konczal) (09/26/90)

It is not hard to use crypt(3) to write a program that will read a
password from a file, encrypt it, and put it into /etc/passwd.  Read
the man page.  It is not recommended to keep unencrypted passwords
lying around, though, since your passwords will be only as secure as
the file containing them.

--Joe Konczal		konczal@mail-gw.ncsl.nist.gov

brnstnd@kramden.acf.nyu.edu (Dan Bernstein) (09/26/90)

In article <24596@adm.BRL.MIL> ITMS400@indycms.iupui.edu (Manjit Trehan) writes:
> Is there any way to have the adduser program set passwords from a
> file.

It's usually a bad idea to store plaintext passwords.

> It seems to not use stdin to read the password, rather,
> opens the tty device to read the password (??).

Under BSD systems, the general solution to this problem is to run ``pty
adduser'' with the input and output redirected whatever way you want.
pty 3.001 and its first patch are available from me or via anonymous ftp
to 128.122.128.22; they'll appear on c.s.unix as soon as Rich gets
enough hate mail :-).

---Dan

PHILIP@ucc.uwindsor.ca (Philip Smith, Systems Programmer) (09/26/90)

Manjit,

If you have the source to the passwd program then you can do what you want.
I have done something similar to what you are looking for.


Philip Smith
Systems Programmer
University of Windsor

bhoughto@cmdnfs.intel.com (Blair P. Houghton) (09/26/90)

In article <186@inews.intel.com> bhoughto@cmdnfs.intel.com (Blair P. Houghton) writes:
>In article <24596@adm.BRL.MIL> ITMS400@indycms.iupui.edu ( Manjit Trehan) writes:
>>
>>Is there any way to have the adduser program set passwords from a
>>file.  It seems to not use stdin to read the password, rather,
>>opens the tty device to read the password (??).
>
>On most systems you'd use makekey(3).

Oops.  makekey(8).  crypt(3).

				--Blair
				  "Mars needs women.
				   Apollo needs a keyboard."

cliffs@playroom.Central.Sun.COM (Clifford C. Skolnick) (10/01/90)

In article <24596@adm.BRL.MIL> ITMS400@indycms.iupui.edu ( Manjit Trehan) writes:
>
>Is there any way to have the adduser program set passwords from a
>file.  It seems to not use stdin to read the password, rather,
>opens the tty device to read the password (??).


Ok, we can fool the getpass(3) routine into reading standard input, unless you
are on a System V machine which you can hope the program will handle intself
(I doubt it).  Write a small wrapper C program that will issue a TIOCNOTTY
ioctl(2) on standard input.  This way when getpass(3) will be unable
to open /dev/tty and will punt to standard input.
--
   Cliff Skolnick - Technical Consultant                  cliffs@east.sun.com
           [I only work for Sun, I do not speak for them]

         "The floggings will continue until morale improves"