Well, I don't get it, I have no idea why the sample code doesn't work for
me. It appears to be a matter of ?importing? the gem correctly. What's
the correct syntax, please? How do you know what the syntax is to ?
import? the gem correctly?
thufir@dur:~/ruby/ssh$
thufir@dur:~/ruby/ssh$ ruby ssh.rb
trying to connect...
ssh.rb:10:in `<main>': undefined local variable or method `ssh' for
main:Object (NameError)
thufir@dur:~/ruby/ssh$
thufir@dur:~/ruby/ssh$ nl ssh.rb
1 require 'rubygems'
2 require 'net/ssh/telnet'
ah, ok. I thought I'd tried that, but apparently not. There's no login,
I just would like to pass some commands to leafnode and get the response.
Am I not getting the output correctly?
thufir@dur:~/ruby/ssh$
thufir@dur:~/ruby/ssh$ ruby ssh.rb
trying to connect...
# 0x00000: 54 72 79 69 6e 67 20 31 32 37 2e 30 2e 30 2e 31 Trying
127.0.0.1
# 0x00010: 2e 2e 2e 0a ....
/home/thufir/.rvm/gems/ruby-1.9.3-p125/gems/net-ssh-telnet-0.0.2/lib/net/
ssh/telnet.rb:219:in `rescue in initialize': timed out while opening a
connection to the host (Timeout::Error)
from /home/thufir/.rvm/gems/ruby-1.9.3-p125/gems/net-ssh-
telnet-0.0.2/lib/net/ssh/telnet.rb:208:in `initialize'
from ssh.rb:5:in `new'
from ssh.rb:5:in `<main>'
thufir@dur:~/ruby/ssh$
thufir@dur:~/ruby/ssh$ nl ssh.rb
1 require 'rubygems'
2 require 'net/ssh/telnet'
you're right, when I read that last night I was a bit tired.
I'm trying to look at the corresponding API for "non-ssh" telnet, to
figure out how to login to leafnode and get the output printed to the
screen. I just get timeouts so far:
thufir@dur:~/ruby/ssh$
thufir@dur:~/ruby/ssh$ ruby ssh.rb
trying to connect...
# 0x00000: 54 72 79 69 6e 67 20 31 32 37 2e 30 2e 30 2e 31 Trying
127.0.0.1
# 0x00010: 2e 2e 2e 0a ....
[1]+ Stopped ruby ssh.rb
thufir@dur:~/ruby/ssh$
thufir@dur:~/ruby/ssh$ /home/thufir/.rvm/gems/ruby-1.9.3-p125/gems/net-
ssh-telnet-0.0.2/lib/net/ssh/telnet.rb:219:in `rescue in initialize':
timed out while opening a connection to the host (Timeout::Error)
from /home/thufir/.rvm/gems/ruby-1.9.3-p125/gems/net-ssh-
telnet-0.0.2/lib/net/ssh/telnet.rb:208:in `initialize'
from ssh.rb:5:in `new'
from ssh.rb:5:in `<main>'
In fact, it doesn't even seem to be "logging in" since that put never
executes. Am I using the right API? If so, how do I get the response
which "telnet localhost nntp" brings up in the terminal?