From: Jamis Buck Date: 2004-10-08T23:18:44+09:00 Subject: Re: net-ssh help 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.org/jamis