[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

net-ssh help

Carl Youngblood

10/8/2004 5:55:00 AM

Hello,
I'm trying to use net-ssh for the first time and having some trouble.
Any help would be greatly appreciated.

In a simple script I'm running with the first few lines like so:

Net::SSH.start('myhost, 'user', 'pass') do |session|
Net::SSH::SFTP.session(session) do |sftp|
if not sftp.put_file(domainfile, "blocks/#{domainfile}")
raise "Couldn't upload domain file"
end
if not sftp.put_file(actionfile, "blocks/#{actionfile}")
raise "Couldn't upload action file"
end
end
end

I get the following error:

could not load public key file '/Users/carl/.ssh/id_rsa.pub'
(uninitialized constant OpenSSL::PKey::PKey::Base64 [NameError])

I'm wondering why it fails trying to load the public key file when A)
it's there and it's readable by the current user, and B) I've already
specified the username and password explicitly, so it doesn't matter
if it succeeds in reading the public key file.

I figured maybe there was something special in rb-keygen beyond what
was in ssh-keygen, so I ran it, but I got the following error when I
did that:

/usr/local/bin/rb-keygen:25:in `require': No such file to load --
net/ssh/transport/buffer (LoadError)
from /usr/local/bin/rb-keygen:25

I installed net-ssh using the setup.rb method, in case it helps. And
I'm using OS X.

Thanks,
Carl


3 Answers

Jamis Buck

10/8/2004 2:19:00 PM

0

Carl Youngblood wrote:
> Hello,
> I'm trying to use net-ssh for the first time and having some trouble.
> Any help would be greatly appreciated.
>
> In a simple script I'm running with the first few lines like so:
>
> Net::SSH.start('myhost, 'user', 'pass') do |session|
> Net::SSH::SFTP.session(session) do |sftp|
> if not sftp.put_file(domainfile, "blocks/#{domainfile}")
> raise "Couldn't upload domain file"
> end
> if not sftp.put_file(actionfile, "blocks/#{actionfile}")
> raise "Couldn't upload action file"
> end
> end
> end
>
> I get the following error:
>
> could not load public key file '/Users/carl/.ssh/id_rsa.pub'
> (uninitialized constant OpenSSL::PKey::PKey::Base64 [NameError])

Carl,

A few questions: what version of Ruby are you using? Do you get a
backtrace with the error? If so, could you post it?

The problem, it looks like, is that the Base64 library cannot be found,
which is worrisome, since it's part of the standard library. If that
can't be found, then either (a) you're using a pre-1.8 version of Ruby,
or (b) you're Ruby installation is incorrect or incomplete.

>
> I'm wondering why it fails trying to load the public key file when A)
> it's there and it's readable by the current user, and B) I've already
> specified the username and password explicitly, so it doesn't matter
> if it succeeds in reading the public key file.

The failure isn't because the file couldn't be opened, its because the
Base64 module couldn't be found while the key was being processed.

>
> I figured maybe there was something special in rb-keygen beyond what
> was in ssh-keygen, so I ran it, but I got the following error when I
> did that:
>
> /usr/local/bin/rb-keygen:25:in `require': No such file to load --
> net/ssh/transport/buffer (LoadError)
> from /usr/local/bin/rb-keygen:25

This seems to indicate a borked installation as well... perhaps your
Ruby load paths are wrong? Try this:

ruby -e 'p $:'

Could you send me the paths that it emits? Also:

ruby -rnet/ssh -e 'p $"'

Could you send me that output of that command?

- Jamis

--
Jamis Buck
jgb3@email.byu.edu
http://www.jamisbuck...


Brian Candler

10/8/2004 2:46:00 PM

0

On Fri, Oct 08, 2004 at 11:18:44PM +0900, Jamis Buck wrote:
> >I get the following error:
> >
> >could not load public key file '/Users/carl/.ssh/id_rsa.pub'
> >(uninitialized constant OpenSSL::PKey::PKey::Base64 [NameError])

what happens if you do in irb:

require 'base64'
Base64.decode64("aGVsbG8h\n")


Carl Youngblood

10/8/2004 7:44:00 PM

0

Thanks for the tips. I'm not in front of my mac now, but my ruby
setup was installed from CVS about 6 months ago and has accumulated a
lot of cruft over time. I've been wanting to clean things up for a
while now, so I think maybe I'll kill it and start from scratch again,
this time with a stable release.

On Fri, 8 Oct 2004 23:18:44 +0900, Jamis Buck <jgb3@email.byu.edu> wrote:
> Carl Youngblood wrote:
> > Hello,
> > I'm trying to use net-ssh for the first time and having some trouble.
> > Any help would be greatly appreciated.
> >
> > In a simple script I'm running with the first few lines like so:
> >
> > Net::SSH.start('myhost, 'user', 'pass') do |session|
> > Net::SSH::SFTP.session(session) do |sftp|
> > if not sftp.put_file(domainfile, "blocks/#{domainfile}")
> > raise "Couldn't upload domain file"
> > end
> > if not sftp.put_file(actionfile, "blocks/#{actionfile}")
> > raise "Couldn't upload action file"
> > end
> > end
> > end
> >
> > I get the following error:
> >
> > could not load public key file '/Users/carl/.ssh/id_rsa.pub'
> > (uninitialized constant OpenSSL::PKey::PKey::Base64 [NameError])
>
> Carl,
>
> A few questions: what version of Ruby are you using? Do you get a
> backtrace with the error? If so, could you post it?
>
> The problem, it looks like, is that the Base64 library cannot be found,
> which is worrisome, since it's part of the standard library. If that
> can't be found, then either (a) you're using a pre-1.8 version of Ruby,
> or (b) you're Ruby installation is incorrect or incomplete.
>
> >
> > I'm wondering why it fails trying to load the public key file when A)
> > it's there and it's readable by the current user, and B) I've already
> > specified the username and password explicitly, so it doesn't matter
> > if it succeeds in reading the public key file.
>
> The failure isn't because the file couldn't be opened, its because the
> Base64 module couldn't be found while the key was being processed.
>
> >
> > I figured maybe there was something special in rb-keygen beyond what
> > was in ssh-keygen, so I ran it, but I got the following error when I
> > did that:
> >
> > /usr/local/bin/rb-keygen:25:in `require': No such file to load --
> > net/ssh/transport/buffer (LoadError)
> > from /usr/local/bin/rb-keygen:25
>
> This seems to indicate a borked installation as well... perhaps your
> Ruby load paths are wrong? Try this:
>
> ruby -e 'p $:'
>
> Could you send me the paths that it emits? Also:
>
> ruby -rnet/ssh -e 'p $"'
>
> Could you send me that output of that command?
>
> - Jamis