Net::SSH difficulties

Discussion in 'Ruby' started by Hal Fulton, Jul 20, 2004.

  1. Hal Fulton

    Hal Fulton Guest

    I just installed Net::SSH 0.0.3 and started to play with it.

    The first simple thing I tried bombed on me.

    All info below.

    Jamis or whoever else -- thanks for any assistance.


    Cheers,
    Hal



    (This is FC1 and Ruby 1.8.2)

    Here's the script (a trivial mod of one of the examples):


    require 'net/ssh'

    domain = 'WhoWantsToKnow.com'
    user = 'hal'
    pass = 'yeah,youwish'

    Net::SSH.start(domain,user,pass) do |session|
    result = session.exec( "ls -la" )
    puts result.data
    puts "-------------------------------------------"
    result = session.exec( "ls -la /" )
    puts result.data
    puts "-------------------------------------------"
    result = session.exec( "echo $HOME" )
    puts result.data
    end


    And here's the result:


    /usr/local/lib/ruby/gems/1.8/gems/net-ssh-0.0.3/lib/net/ssh/transport/kex/dh.rb:60:in
    `initialize': wrong number of arguments (0 for 1) (ArgumentError)
    from
    /usr/local/lib/ruby/gems/1.8/gems/net-ssh-0.0.3/lib/net/ssh/transport/kex/dh.rb:60:in
    `new'
    from
    /usr/local/lib/ruby/gems/1.8/gems/net-ssh-0.0.3/lib/net/ssh/transport/kex/dh.rb:60:in
    `exchange_keys'
    from
    /usr/local/lib/ruby/gems/1.8/gems/net-ssh-0.0.3/lib/net/ssh/transport/session.rb:292:in
    `exchange_keys'
    from
    /usr/local/lib/ruby/gems/1.8/gems/net-ssh-0.0.3/lib/net/ssh/transport/session.rb:124:in
    `initialize'
    from /usr/local/lib/ruby/gems/1.8/gems/net-ssh-0.0.3/lib/net/ssh.rb:119:in `new'
    from /usr/local/lib/ruby/gems/1.8/gems/net-ssh-0.0.3/lib/net/ssh.rb:119:in
    `open'
    from /usr/local/lib/ruby/gems/1.8/gems/net-ssh-0.0.3/lib/net/ssh.rb:67:in
    `start'
    from ssh1.rb:7
    Hal Fulton, Jul 20, 2004
    #1
    1. Advertising

  2. Hal Fulton

    Jamis Buck Guest

    Hal Fulton wrote:
    > I just installed Net::SSH 0.0.3 and started to play with it.
    >
    > The first simple thing I tried bombed on me.
    >
    > All info below.
    >
    > Jamis or whoever else -- thanks for any assistance.
    >
    >
    > Cheers,
    > Hal
    >
    >
    >
    > (This is FC1 and Ruby 1.8.2)
    >
    > Here's the script (a trivial mod of one of the examples):
    >
    >
    > require 'net/ssh'
    >
    > domain = 'WhoWantsToKnow.com'
    > user = 'hal'
    > pass = 'yeah,youwish'
    >
    > Net::SSH.start(domain,user,pass) do |session|
    > result = session.exec( "ls -la" )
    > puts result.data
    > puts "-------------------------------------------"
    > result = session.exec( "ls -la /" )
    > puts result.data
    > puts "-------------------------------------------"
    > result = session.exec( "echo $HOME" )
    > puts result.data
    > end
    >
    >
    > And here's the result:
    >
    >
    > /usr/local/lib/ruby/gems/1.8/gems/net-ssh-0.0.3/lib/net/ssh/transport/kex/dh.rb:60:in
    > `initialize': wrong number of arguments (0 for 1) (ArgumentError)
    > from
    > /usr/local/lib/ruby/gems/1.8/gems/net-ssh-0.0.3/lib/net/ssh/transport/kex/dh.rb:60:in
    > `new'
    > from
    > /usr/local/lib/ruby/gems/1.8/gems/net-ssh-0.0.3/lib/net/ssh/transport/kex/dh.rb:60:in
    > `exchange_keys'
    > from
    > /usr/local/lib/ruby/gems/1.8/gems/net-ssh-0.0.3/lib/net/ssh/transport/session.rb:292:in
    > `exchange_keys'
    > from
    > /usr/local/lib/ruby/gems/1.8/gems/net-ssh-0.0.3/lib/net/ssh/transport/session.rb:124:in
    > `initialize'
    > from
    > /usr/local/lib/ruby/gems/1.8/gems/net-ssh-0.0.3/lib/net/ssh.rb:119:in `new'
    > from
    > /usr/local/lib/ruby/gems/1.8/gems/net-ssh-0.0.3/lib/net/ssh.rb:119:in
    > `open'
    > from
    > /usr/local/lib/ruby/gems/1.8/gems/net-ssh-0.0.3/lib/net/ssh.rb:67:in
    > `start'
    > from ssh1.rb:7


    Hal,

    It looks like you're using an unpatched version of the OpenSSL module
    for Ruby. One of the changes I submitted to that module was to allow
    "blank" keys to be created, and initialized later. Previously, the key
    constructors always required at least one parameter.

    Can you please verify that you are, indeed, using 1.8.2? (I assume you
    mean, by 1.8.2, that you're using a CVS snapshot...?) When did you
    install it? Could it be that you are using a version that is "old"
    enough that it doesn't include the patch I submitted?

    Thanks,

    Jamis

    --
    Jamis Buck

    http://www.jamisbuck.org/jamis

    "I use octal until I get to 8, and then I switch to decimal."
    Jamis Buck, Jul 20, 2004
    #2
    1. Advertising

  3. Hal Fulton

    Hal Fulton Guest

    Jamis Buck wrote:
    > Hal,
    >
    > It looks like you're using an unpatched version of the OpenSSL module
    > for Ruby. One of the changes I submitted to that module was to allow
    > "blank" keys to be created, and initialized later. Previously, the key
    > constructors always required at least one parameter.
    >
    > Can you please verify that you are, indeed, using 1.8.2? (I assume you
    > mean, by 1.8.2, that you're using a CVS snapshot...?) When did you
    > install it? Could it be that you are using a version that is "old"
    > enough that it doesn't include the patch I submitted?


    ruby -v yields: ruby 1.8.2 (2004-07-08) [i686-linux]

    I think this was a nightly snapshot from a couple of weeks ago. I don't
    think I got it directly from CVS, but from the (presumably) auto-generated
    tgz file.

    But that was on top of 1.8.1 -- is it possible that my install is screwed
    up somehow?

    FYI, I installed ssh via the gem.

    I downloaded the patch but decided I didn't need it.

    Here's a list of some related files with timestamps. What do you think?

    Thanks,
    Hal


    $ find /usr -name openssl* 2>/dev/null | grep ruby | xargs ls -ld
    -rwxr-xr-x 1 root root 168184 Aug 5 2003
    /usr/lib/ruby/1.8/i386-linux-gnu/openssl.so
    drwxr-xr-x 2 root root 4096 Jan 26 15:40 /usr/lib/ruby/1.8/openssl
    -rw-r--r-- 1 root root 526 Jul 23 2003 /usr/lib/ruby/1.8/openssl.rb
    -rwxr-xr-x 1 root root 1492905 Feb 2 03:05
    /usr/local/lib/ruby/1.8/i686-linux/openssl.so
    drwxr-xr-x 2 root root 4096 Jan 27 13:16 /usr/local/lib/ruby/1.8/openssl
    -rw-r--r-- 1 root root 526 Jul 23 2003 /usr/local/lib/ruby/1.8/openssl.rb
    -rw-r--r-- 1 root root 5464 Jul 19 23:33
    /usr/local/lib/ruby/gems/1.8/gems/net-ssh-0.0.3/lib/net/ssh/openssl.rb
    drwxr-xr-x 3 root root 4096 Jan 26 15:40
    /usr/share/doc/ruby-libs-1.8.0/ext/openssl
    drwxr-xr-x 3 1000 1000 4096 Feb 2 03:05 /usr/src/self/ruby-1.8.1/ext/openssl
    drwxr-xr-x 2 1000 1000 4096 Dec 24 2003
    /usr/src/self/ruby-1.8.1/ext/openssl/lib/openssl
    -rw-r--r-- 1 1000 1000 526 Jul 23 2003
    /usr/src/self/ruby-1.8.1/ext/openssl/lib/openssl.rb
    -rw-r--r-- 1 1000 1000 6827 Sep 13 2003
    /usr/src/self/ruby-1.8.1/ext/openssl/openssl_missing.c
    -rw-r--r-- 1 1000 1000 3356 Sep 13 2003
    /usr/src/self/ruby-1.8.1/ext/openssl/openssl_missing.h
    -rw-r--r-- 1 root root 41500 Feb 2 03:04
    /usr/src/self/ruby-1.8.1/ext/openssl/openssl_missing.o
    -rwxr-xr-x 1 root root 1492905 Feb 2 03:05
    /usr/src/self/ruby-1.8.1/ext/openssl/openssl.so
    drwxr-xr-x 2 1000 1000 4096 Dec 24 2003 /usr/src/self/ruby-1.8.1/sample/openssl
    drwxr-xr-x 3 103 nfsnobody 4096 Jul 8 14:37 /usr/src/self/ruby/ext/openssl
    drwxr-xr-x 2 103 nfsnobody 4096 Jul 8 14:00
    /usr/src/self/ruby/ext/openssl/lib/openssl
    -rw-r--r-- 1 103 nfsnobody 526 Jul 23 2003
    /usr/src/self/ruby/ext/openssl/lib/openssl.rb
    -rw-r--r-- 1 103 nfsnobody 7409 Jun 30 22:01
    /usr/src/self/ruby/ext/openssl/openssl_missing.c
    -rw-r--r-- 1 103 nfsnobody 4108 Jun 30 22:01
    /usr/src/self/ruby/ext/openssl/openssl_missing.h
    drwxr-xr-x 2 103 nfsnobody 4096 Jul 8 14:00 /usr/src/self/ruby/sample/openssl
    drwxr-xr-x 2 103 nfsnobody 4096 Jul 8 14:00 /usr/src/self/ruby/test/openssl
    Hal Fulton, Jul 20, 2004
    #3
  4. Hal Fulton

    Jamis Buck Guest

    Hal Fulton wrote:
    > Jamis Buck wrote:
    >
    >> Hal,
    >>
    >> It looks like you're using an unpatched version of the OpenSSL module
    >> for Ruby. One of the changes I submitted to that module was to allow
    >> "blank" keys to be created, and initialized later. Previously, the key
    >> constructors always required at least one parameter.
    >>
    >> Can you please verify that you are, indeed, using 1.8.2? (I assume you
    >> mean, by 1.8.2, that you're using a CVS snapshot...?) When did you
    >> install it? Could it be that you are using a version that is "old"
    >> enough that it doesn't include the patch I submitted?

    >
    >
    > ruby -v yields: ruby 1.8.2 (2004-07-08) [i686-linux]
    >
    > I think this was a nightly snapshot from a couple of weeks ago. I don't
    > think I got it directly from CVS, but from the (presumably) auto-generated
    > .tgz file.
    >
    > But that was on top of 1.8.1 -- is it possible that my install is screwed
    > up somehow?
    >
    > FYI, I installed ssh via the gem.
    >
    > I downloaded the patch but decided I didn't need it.
    >
    > Here's a list of some related files with timestamps. What do you think?
    >


    Try this:

    ruby -ropenssl -e "p OpenSSL::pKey::DH.instance_method:)g)"

    If that gives you an error, then you've got an old version of the
    OpenSSL module. Installing on top of 1.8.1 MIGHT have caused problems,
    but I wouldn't have thought so. At any rate, if the above works, then
    the problem is something else. If it doesn't, then we can take it from
    there.

    - Jamis

    --
    Jamis Buck

    http://www.jamisbuck.org/jamis

    "I use octal until I get to 8, and then I switch to decimal."
    Jamis Buck, Jul 20, 2004
    #4
  5. Hal Fulton

    Hal Fulton Guest

    Jamis Buck wrote:
    >
    > Try this:
    >
    > ruby -ropenssl -e "p OpenSSL::pKey::DH.instance_method:)g)"
    >
    > If that gives you an error, then you've got an old version of the
    > OpenSSL module. Installing on top of 1.8.1 MIGHT have caused problems,
    > but I wouldn't have thought so. At any rate, if the above works, then
    > the problem is something else. If it doesn't, then we can take it from
    > there.


    $ ruby -ropenssl -e "p OpenSSL::pKey::DH.instance_method:)g)"
    -e:1:in `instance_method': undefined method `g' for class `OpenSSL::pKey::DH' (NameError)
    from -e:1


    Umm, I just noticed that the only openssl.so files I have are fairly
    old... is the .so supposed to be the same timestamp as the .rb, more
    or less?


    Hal
    Hal Fulton, Jul 20, 2004
    #5
  6. Hal Fulton

    Jamis Buck Guest

    Hal Fulton wrote:
    > Jamis Buck wrote:
    >
    >>
    >> Try this:
    >>
    >> ruby -ropenssl -e "p OpenSSL::pKey::DH.instance_method:)g)"
    >>
    >> If that gives you an error, then you've got an old version of the
    >> OpenSSL module. Installing on top of 1.8.1 MIGHT have caused problems,
    >> but I wouldn't have thought so. At any rate, if the above works, then
    >> the problem is something else. If it doesn't, then we can take it from
    >> there.

    >
    >
    > $ ruby -ropenssl -e "p OpenSSL::pKey::DH.instance_method:)g)"
    > -e:1:in `instance_method': undefined method `g' for class
    > `OpenSSL::pKey::DH' (NameError)
    > from -e:1
    >
    >
    > Umm, I just noticed that the only openssl.so files I have are fairly
    > old... is the .so supposed to be the same timestamp as the .rb, more
    > or less?


    I would certainly expect the .so to have a similar timestamp to the .rb.
    Perhaps the install was borked somehow? At any rate, it looks like
    your OpenSSL ruby module is stale. :(

    --
    Jamis Buck

    http://www.jamisbuck.org/jamis

    "I use octal until I get to 8, and then I switch to decimal."
    Jamis Buck, Jul 20, 2004
    #6
  7. Hal Fulton

    Hal Fulton Guest

    Jamis Buck wrote:
    >> Umm, I just noticed that the only openssl.so files I have are fairly
    >> old... is the .so supposed to be the same timestamp as the .rb, more
    >> or less?

    >
    >
    > I would certainly expect the .so to have a similar timestamp to the .rb.
    > Perhaps the install was borked somehow? At any rate, it looks like your
    > OpenSSL ruby module is stale. :(


    OK, thanks, I will rebuild and try it again after lunch.

    Thanks much,
    Hal
    Hal Fulton, Jul 20, 2004
    #7
  8. VIM Extensions on OS X

    I'm getting the following errors with OS X 10.3 Panther preinstalled Vim
    and the vim-ruby-snapshot-2003-10-12.tar.gz
    <http://rubyforge.org/frs/download.php/147/vim-ruby-snapshot-2003-10-12.tar.gz>
    vim extensions:

    E492: Not an editor command: ^M
    ...

    I'm guessing that the extensions I downloaded have windows line endings,
    and I need to strip them. Is there another download I missed?

    Thanks,
    Nick
    Nicholas Van Weerdenburg, Jul 21, 2004
    #8
  9. Re: VIM Extensions on OS X

    More info...

    I used tr -d '\r' < ruby.vim > ruby.vim.osx and then renamed for the
    syntax, indent, and ftplugin ruby.vim files, and everything seems fine.

    Still wondering if I did something wrong, or if later vims handle \n\r
    line endings better.

    Thanks,
    Nick

    Nicholas Van Weerdenburg wrote:

    > I'm getting the following errors with OS X 10.3 Panther preinstalled
    > Vim and the vim-ruby-snapshot-2003-10-12.tar.gz
    > <http://rubyforge.org/frs/download.php/147/vim-ruby-snapshot-2003-10-12.tar.gz>
    > vim extensions:
    >
    > E492: Not an editor command: ^M
    > ...
    >
    > I'm guessing that the extensions I downloaded have windows line
    > endings, and I need to strip them. Is there another download I missed?
    >
    > Thanks,
    > Nick
    >
    Nicholas Van Weerdenburg, Jul 21, 2004
    #9
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. loial
    Replies:
    0
    Views:
    387
    loial
    Feb 3, 2009
  2. loial
    Replies:
    0
    Views:
    391
    loial
    Feb 10, 2009
  3. Tench Johnson
    Replies:
    1
    Views:
    279
    Biff Tannen
    Apr 23, 2010
  4. salamond

    net/ssh in ruby. ssh.exec fails

    salamond, Feb 17, 2011, in forum: Ruby
    Replies:
    0
    Views:
    226
    salamond
    Feb 17, 2011
  5. Replies:
    0
    Views:
    80
Loading...

Share This Page