I would like to reset passwords on a bunch of boxes over SSH. Any pointers on how Erlang could be used for this purpose?
A:
Roberto Aloi
2010-06-22 15:09:32
Please see the comment above.
tbikeev
2010-06-22 19:14:44
the FAQ saying it's not made for exactly that purpose is no indication of how appropriate a language is. the tools are there to solve it and the "not particularly suitable for" section doesn't even apply.
Felix Lange
2010-06-28 21:00:00
And the question is actually "how can I use Erlang for this...", not "should I use Erlang for this..."
Adam Lindberg
2010-07-14 08:47:12
Fair enough. This was just my opinion, emerged after using Erlang ssh for similar things and realizing that other alternatives could have worked as well in a simpler way. Mine was more a comment rather than a question, but it was too long to put it there :)
Roberto Aloi
2010-07-14 09:18:02
+1
A:
Erlang is indeed a well-suited choice for this problem.
You should have a look at the ssh module. Start a connection with
ssh:connect(Host, Port, Options).
Then use the ssh_connection module to execute the right passwd
command (hint: start a shell first) and log out.
Edit: The above is mostly wrong, this blog post might get you started faster.
You can even write a simple server that does all of these things on several hosts in parallel, resulting in the most multicore-capable multi-host ssh password changer on this very planet. Weekend project idea: make a web app out of it.
Felix Lange
2010-06-28 20:11:09
I just hope he doesn't have to deal with public keys protected by a password, since they are not handled by the entire ssh application (unless the OTP team recently introduced it)...
Roberto Aloi
2010-06-29 10:34:32
Well, unfortunately I need to cover for the cases like: password-expired-pls-provide-new-validate-re-login hence the whole "expect" question.
tbikeev
2010-06-29 10:49:15