> I've been working on some Linux/Sendmail scripts to manipulate accounts
> from a Windows NT RSH session, and have a few questions for anyone
> willing to help.
> 
> 1. We're shadowing passwords (of course), which forces us to go through
> the passwd utility to setup and/or change the password on an account.
> Is there a way to use the passwd utility from within a script?  Or is
> there an alternative, non-interactive, PAM compliant, way to setup/alter
> passwords, via bash (or perl) scripting, that might be a better
> solution?  If I can't find another way I'm leaning towards unencrypted
> passwords in the passwd file.  Then it would be stupid simple to use
> sed, but I'm very uncomfortable with the idea.
> 

If you can't drive passed from redirected stdin (I'v not tried it) as in 
this
passwd user <<ZZZ
passwd stuff here
ZZZ

then you can almost certainly drive it with expect; I've used expect with 
telnet to good effect, I expect it will drive passwd too.

Failing all else, peruse passwd's source code and either adapt it to do 
what you want, or lift the code that encrypts the password (I'ts probably 
no more than a function call) and write a wrapper (in C) that takes the 
password and writes the encrypted version to stdout.


-- 
Cheers
John Summerfield
http://os2.ami.com.au/os2/ for OS/2 support.
Configuration, networking, combined IBM ftpsites index.



-- 
To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe"
as the Subject.

Reply via email to