Hi List,
I've a big problema using the last version net-ssh on my Ubuntu (i386)
system.
My goal is execute a command on a remote system. I tried many things
including the manual examples:
1) using exec
require 'net/ssh'
Net::SSH.start('192.168.1.10','test','test') do |ssh|
result = ssh.exec!("id")
puts result
end
···
-----
/usr/lib/ruby/1.8/net/ssh/session.rb:199:in `method_missing': private
method `exec' called for #<Net::SSH::Session:0xb7c7a404> (NoMethodError)
from test.rb:6
from /usr/lib/ruby/1.8/net/ssh/session.rb:138:in `initialize'
from /usr/lib/ruby/1.8/net/ssh.rb:47:in `new'
from /usr/lib/ruby/1.8/net/ssh.rb:47:in `start'
from test.rb:5
2) using exec into a channel
require 'net/ssh'
Net::SSH.start('192.168.1.10','test','test',:paranoid => false,:host_key
=> "ssh-rsa",:encryption => "blowfish-cbc") do |ssh|
ssh.open_channel do |channel|
channel.exec "id" do |ch, stream, data|
if stream == :stderr
puts "ERROR: #{data}"
else
puts data
end
end
channel.close
end
ssh.loop
end
------
No output...
What's the problem? Any tips?
Thank you
Al
--
Posted via http://www.ruby-forum.com/.
Hi,
you are probably not connected at all.
Could you run the code from example 1 with this change:
Net::SSH.start('192.168.1.10','test',:password => 'test', :verbose =>
:debug) do |ssh|
...
and show the output of this code ?
Secondly - there are many implementations of sshd deamon in *nix world - if
you are having
problems with channels (or line terminator) you could try ssh:telnet gem. It
works for me.
···
2010/5/13 Alfonso Caponi <alfonso.caponi@gmail.com>
Hi List,
I've a big problema using the last version net-ssh on my Ubuntu (i386)
system.
My goal is execute a command on a remote system. I tried many things
including the manual examples:
1) using exec
require 'net/ssh'
Net::SSH.start('192.168.1.10','test','test') do |ssh|
result = ssh.exec!("id")
puts result
end
-----
/usr/lib/ruby/1.8/net/ssh/session.rb:199:in `method_missing': private
method `exec' called for #<Net::SSH::Session:0xb7c7a404> (NoMethodError)
from test.rb:6
from /usr/lib/ruby/1.8/net/ssh/session.rb:138:in `initialize'
from /usr/lib/ruby/1.8/net/ssh.rb:47:in `new'
from /usr/lib/ruby/1.8/net/ssh.rb:47:in `start'
from test.rb:5
2) using exec into a channel
require 'net/ssh'
Net::SSH.start('192.168.1.10','test','test',:paranoid => false,:host_key
=> "ssh-rsa",:encryption => "blowfish-cbc") do |ssh|
ssh.open_channel do |channel|
channel.exec "id" do |ch, stream, data|
if stream == :stderr
puts "ERROR: #{data}"
else
puts data
end
end
channel.close
end
ssh.loop
end
------
No output...
What's the problem? Any tips?
Thank you
Al
--
Posted via http://www.ruby-forum.com/\.
--
trednu@gmail.com