[ANN] Net::SSH 0.0.4 "Happy Birthday To Me"

Net::SSH is a pure Ruby implementation of the SSH2 client protocol.

   http://rubyforge.org/projects/net-ssh

Lots of new goodness in 0.0.4. The ChangeLog has the full rundown, but here's a summary of the highlights:

   * SSH exceptions, instead of RuntimeError

   * Private keys should be loaded correctly now, even if they require a passphrase or have some other special header values.

   * Support for interacting with processes executed on the remote host.

   * Earlier OpenSSH servers (3.1p1, for example) are now supported.

   * You can now specify the keys to use when authenticating.

It's probably getting to be time for me to stop adding features for a bit and document what I've already got. Expect some decent documentation in the next release.

Some interfaces are different in this version, so anticipate some minor borkage in your scripts.

Special thanks for this release go to Hal Fulton (who helped me hunt down the problem with earlier versions of OpenSSH servers) and Daniel Hobe, who submitted several great suggestions and who singlehandedly fixed the problem of some key files not loading correctly. Thanks!

Keep those suggestions (and patches!) coming!

Oh, and happy birthday to me. :slight_smile: I'm 30 today.

···

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

"I use octal until I get to 8, and then I switch to decimal."

Net::SSH is a pure Ruby implementation of the SSH2 client protocol.

I'd like to note that Net::SSH also implements SFTP, which didn't occur to me until just now! Jamis tells me that while the implementation isn't yet complete, it's very functional, and in 0.0.4 he just added support for renaming and deleting files over SFTP.

This is quite a big deal for anyone looking to script file transfers between servers. It was the lack of SFTP implementations for Ruby that forced Basecamp to stick with FTP-only transfers for its file upload service.

Thanks a ton, Jamis. SFTP is already on its way into Basecamp :wink:

Oh, and happy birthday to me. :slight_smile: I'm 30 today.

Happy birthday, man. May the next thirty be kind :wink:

···

--
David Heinemeier Hansson,
http://www.rubyonrails.org/ -- Web-application framework for Ruby
http://www.instiki.org/ -- A No-Step-Three Wiki in Ruby
http://www.basecamphq.com/ -- Web-based Project Management
http://www.loudthinking.com/ -- Broadcasting Brain
http://www.nextangle.com/ -- Development & Consulting Services

thanks for this, I'm looking forward to see openuri-like support for
sftp stuff :slight_smile:

and happy birthday :slight_smile:

···

il Mon, 26 Jul 2004 04:08:15 +0900, Jamis Buck <jgb3@email.byu.edu> ha scritto::

gabriele renzi wrote:

thanks for this, I'm looking forward to see openuri-like support for
sftp stuff :slight_smile:

Can you give me an example or two of the syntax you'd like to see? I'd be happy to add something like it into Net::SSH, if at all possible.

and happy birthday :slight_smile:

Thanks. :slight_smile:

···

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

"I use octal until I get to 8, and then I switch to decimal."

gabriele renzi wrote:

thanks for this, I'm looking forward to see openuri-like support for
sftp stuff :slight_smile:

Can you give me an example or two of the syntax you'd like to see? I'd
be happy to add something like it into Net::SSH, if at all possible.

well, I was thinking something really dumb like:

require 'net/ssh/open-sftp'
uri=URI.parse 'sftp://user@host.foo/file.txt'
# add magic to handle key/pass
txt=uri.open.read

btw this has the same problem that handling https with open-uri, wich
I think relates to proper key management.

Anyway, while playing with this I discovered that on windows open-uri
fails with ftp files, due to relying on dev/null:

u=URI.parse('ftp://me:foo@host.it')

=> #<URI::FTP:0x15663ac URL:ftp://me:foo@host.it>

u.open

Errno::ENOENT: No such file or directory - /dev/null
        from C:/Programmi/Ruby/lib/ruby/1.8/open-uri.rb:87:in
`initialize'
        from C:/Programmi/Ruby/lib/ruby/1.8/open-uri.rb:87:in
`open_uri_original
_open'
        from C:/Programmi/Ruby/lib/ruby/1.8/open-uri.rb:87:in `open'
        from C:/Programmi/Ruby/lib/ruby/1.8/net/ftp.rb:497:in
`getbinaryfile'
        from C:/Programmi/Ruby/lib/ruby/1.8/open-uri.rb:594:in
`direct_open'
        from C:/Programmi/Ruby/lib/ruby/1.8/open-uri.rb:169:in
`open_loop'
        from C:/Programmi/Ruby/lib/ruby/1.8/open-uri.rb:164:in `catch'
        from C:/Programmi/Ruby/lib/ruby/1.8/open-uri.rb:164:in
`open_loop'
        from C:/Programmi/Ruby/lib/ruby/1.8/open-uri.rb:134:in
`open_uri'
        from C:/Programmi/Ruby/lib/ruby/1.8/open-uri.rb:424:in `open'
        from (irb):6

ruby -v
ruby 1.8.2 (2004-06-29) [i386-mswin32]

···

il Mon, 26 Jul 2004 07:33:54 +0900, Jamis Buck <jgb3@email.byu.edu> ha scritto::

gabriele renzi wrote:

Anyway, while playing with this I discovered that on windows open-uri
fails with ftp files, due to relying on dev/null:

Don't let Posix-centric software bring you to your knees :wink:

Hack <rubydir>\lib\ruby\1.8\open-uri.rb and replace '/dev/null' with 'NUL'.
(near the end of the script) --

- ftp.getbinaryfile(self.path, '/dev/null', Net::FTP::DEFAU ...
+ ftp.getbinaryfile(self.path, 'NUL', Net::FTP::DEFAU ...

and make it Win-centric !

:daz