I have a script that logs into 1000+ wireless units and audits and them. Some of their passwords have been changed. I would like to skip these units without specifically telling ruby which ips to skip. The script is multithreaded and gets hung up because when ruby sshes into a unit and uses the wrong password it will ask for the password and the whole script comes to a halt.
*How to skip or rescue wrong password attempts for ruby net/ssh
Net::SSH.start('ip','user',password: 'pass', paranoid: false) do |ssh|
end
with the incorrect password will prompt you like so
[email protected]'s password:
In latest net-ssh (2.10.0.beta1), the new option :non_interactive was added to ignore the password prompt. Here are the details.
It works for me. For your case it should be
Net::SSH.start('ip','user',password: 'pass', paranoid: false, :non_interactive=>true) do |ssh|
end
options = { password: password, number_of_password_prompts: 0, timeout: SSH_TIMEOUT }
try to use 'number_of_password_prompts: 0,', It may be perfect
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With