Dear Robert
I give it a simple try..
-----------------------------------------------------
require 'net/ssh'
require 'expect'
host = "127.0.0.1"
user = 'Username' # username
pass = "123123" # password
Net::SSH.start(host, user, :password=> pass) do |ssh|
puts ssh.exec!("pwd")
puts ssh.exec!("sudo passwd Username")
ssh.expect(/^Changing/m) do |newpass|
puts newpass
end
ssh.loop
end
-----------------------------------------------------
but it seems the connection it self doesn't accept the return output
from this command
I mean , if the case is , I got the message then the expect can get
work, but in my case nothing returns
--
Posted via http://www.ruby-forum.com/.