[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Using expect.rb to change a user's password in UNIX

M. Edward (Ed) Borasky

7/23/2007 3:00:00 AM

Victor Reyes wrote:
> Hello World,
>
> Today, I used a Korn Shell script and the UNIX version of expect to
> change a
> user password remotely.
> I would like to use the ruby.rb library to do the same.
> For instance, when you type, in UNIX,
>
> passwd username
> It comes back asking to enter the PW.
> Once you enter it, it comes back asking you to enter it again.
>
> How do I do this using the ruby expect.rb library?
>
> We use this to change a userid on multiple systems at the same time.
>
> Thank you,
>
> Victor
>
If the systems on which the passwords are to be changed are Linux, there
is a "batch password change utility" called "chpasswd". So your Ruby
script can simply encrypt the passwords, generate an input file to
"chpasswd", and execute "chpasswd" as "root".