I am trying to reflect the port as follows:
Net::SSH.start( 'hostname', :username=>'', :password=>'', :port=>1234 ) do |session|
puts session.exec!('echo "hello"')
end
But I am getting error: Connection refused - connect(2) for 176.71.60.78:22 (Errno::ECONNREFUSED)
So according to the "22" in error, it seems for me that the port isnt reflected... Any ideas please?
I see docs inhttps://www.rubydoc.info/github/net-ssh/net-ssh/Net%2FSSH.start
.start(host, user = nil, options = {}, &block)
So
Net::SSH.start('hostname', '', { password: '', port: 1234 }) do |session|
puts session.exec!('echo "hello"')
end
use it like this:
Net::SSH.start( 'host', 'username', {:password => 'password',:port => 'port'}) do |session|
puts session.exec!('echo "hello"')
end
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.