# Net-ssh

**URL:** <https://www.ruby-forum.com/t/net-ssh/188544>\
**Category:** Ruby\
**Created:** [May 13, 2010, 5:33pm UTC](https://www.ruby-forum.com/t/net-ssh/188544 "2010-05-13T17:33:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![al\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/f08c70/32.png) [@al\_S](https://www.ruby-forum.com/u/al_S)\
**Post date:** [May 13, 2010, 5:33pm UTC](https://www.ruby-forum.com/t/net-ssh/188544/1 "2010-05-13T17:33:02Z")

</div>

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

1. 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

---

<div class="post-metadata">

**Author:** ![al\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/f08c70/32.png) [@al\_S](https://www.ruby-forum.com/u/al_S)\
**Post date:** [May 14, 2010, 4:53am UTC](https://www.ruby-forum.com/t/net-ssh/188544/2 "2010-05-14T04:53:30Z")

</div>

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 C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
