[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

copy remote a file

Bu Mihai

9/30/2008 8:16:00 AM

How can i copy with ruby a file from my computer to another computer
from lan? I have the administrator password of that computer.
--
Posted via http://www.ruby-....

4 Answers

Brian Candler

9/30/2008 8:40:00 AM

0

Bu Mihai wrote:
> How can i copy with ruby a file from my computer to another computer
> from lan? I have the administrator password of that computer.

If the way you login to the other computer is with ssh, then I'd suggest
using Net::SFTP (available as a gem)
--
Posted via http://www.ruby-....

Dick Davies

9/30/2008 8:51:00 AM

0

On Tue, Sep 30, 2008 at 9:15 AM, Bu Mihai <mihai.bulhac@yahoo.com> wrote:
> How can i copy with ruby a file from my computer to another computer
> from lan? I have the administrator password of that computer.

If it's UNIX/Linux, use scp . If it's Windows, expect you can use file shares
(or just stick it on a webserver and pull it down with a browser).



--
Rasputnik :: Jack of All Trades - Master of Nuns
http://number9.helloope...

Bu Mihai

9/30/2008 9:29:00 AM

0

Brian Candler wrote:
> Bu Mihai wrote:
>> How can i copy with ruby a file from my computer to another computer
>> from lan? I have the administrator password of that computer.
>
> If the way you login to the other computer is with ssh, then I'd suggest
> using Net::SFTP (available as a gem)

i have this problem with net::sftp:
code:
require 'net/ssh'
require 'net/sftp'
session = Net::SSH.start("machine1","administrator","baubau")

I have this error:
c:/ruby/lib/ruby/gems/1.8/gems/net-ssh-2.0.4/lib/net/ssh.rb:151:in
`start': undefined method `keys' for "baubau":String (NoMethodError)
from connect.rb:10

The machine1 is up and the password is a valid one.
--
Posted via http://www.ruby-....

Todd Benson

9/30/2008 4:34:00 PM

0

On Tue, Sep 30, 2008 at 4:28 AM, Bu Mihai <mihai.bulhac@yahoo.com> wrote:
> Brian Candler wrote:
>> Bu Mihai wrote:
>>> How can i copy with ruby a file from my computer to another computer
>>> from lan? I have the administrator password of that computer.
>>
>> If the way you login to the other computer is with ssh, then I'd suggest
>> using Net::SFTP (available as a gem)
>
> i have this problem with net::sftp:
> code:
> require 'net/ssh'
> require 'net/sftp'
> session = Net::SSH.start("machine1","administrator","baubau")
>
> I have this error:
> c:/ruby/lib/ruby/gems/1.8/gems/net-ssh-2.0.4/lib/net/ssh.rb:151:in
> `start': undefined method `keys' for "baubau":String (NoMethodError)
> from connect.rb:10
>
> The machine1 is up and the password is a valid one.

According to the docs for SSH (and also SFTP), the third parameter
should be a Hash...

session = Net::SSH.start("machine1", "administrator", :password => "baubau")

...or for SFTP...

session = Net::SFTP.start("machine1", "administrator", :password => "baubau")

Try it outside of ruby first (in unix shell)...

> sftp administrator@machine1

Todd