On Fri, 13 Nov 1998 07:56:05 +0000 (GMT) Glynn Clements wrote:

> 
> > I want to be able to change a user's password from a C program...
> > Doing it from a Bash shell would also be o.k.
> > 
> > Problem:
> > I don't want to write the WHOLE thing in C, using crypt command
> > and parsing the passwd file, looking for new GID & UID,
> > i 'm hoping there is a simple solution - i tried the following:
> > 
> > passwd username | echo -e "newpassword\newpassword"
> > 
> > something like this would be perfect....
> > just anyway to set a password with a single non-interactive command!
> 
> The passwd command from util-linux allows the password to be specified
> on the command line; however, this is risky, as it will show up in the
> output of `ps'.
> 
> You can either use expect to script an interactive session, or you can
> get the util-linux source and modify passwd to read the password from
> stdin (it currently reads it directly from the controlling tty).

I think it is posible to use a pseudo-tty within a program or script (perl) so 
that passwd thinks it is talking to a warm body instead of some hot bits (aka 
program).

I haven't done it myself, but I was looking at pseudo-ttys to solve a similiar 
problem on another platform.

regards,

David
--
David Ross

[EMAIL PROTECTED]
Toad Technologies

"I'll be good! I will, I will !"

Reply via email to