copy remote a file

B

Bu Mihai

How can i copy with ruby a file from my computer to another computer
from lan? I have the administrator password of that computer.
 
B

Brian Candler

Bu said:
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)
 
D

Dick Davies

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).
 
B

Bu Mihai

Brian said:
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.
 
T

Todd Benson

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top