Joseph Durbin 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).
--
Glynn Clements <[EMAIL PROTECTED]>