copy remote a file

Discussion in 'Ruby' started by Bu Mihai, Sep 30, 2008.

  1. Bu Mihai

    Bu Mihai Guest

    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-forum.com/.
    Bu Mihai, Sep 30, 2008
    #1
    1. Advertising

  2. 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-forum.com/.
    Brian Candler, Sep 30, 2008
    #2
    1. Advertising

  3. Bu Mihai

    Dick Davies Guest

    On Tue, Sep 30, 2008 at 9:15 AM, 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 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.hellooperator.net/
    Dick Davies, Sep 30, 2008
    #3
  4. Bu Mihai

    Bu Mihai Guest

    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-forum.com/.
    Bu Mihai, Sep 30, 2008
    #4
  5. Bu Mihai

    Todd Benson Guest

    On Tue, Sep 30, 2008 at 4:28 AM, Bu Mihai <> 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
    Todd Benson, Sep 30, 2008
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?ZGF2aWQ=?=

    How to copy a file from web service to a remote client?

    =?Utf-8?B?ZGF2aWQ=?=, Aug 18, 2005, in forum: ASP .Net
    Replies:
    8
    Views:
    7,408
    =?Utf-8?B?ZGF2aWQ=?=
    Aug 19, 2005
  2. Alex
    Replies:
    2
    Views:
    1,199
  3. Replies:
    26
    Views:
    2,083
    Roland Pibinger
    Sep 1, 2006
  4. Dayton Jones

    Remote.pm (File::Remote) problem

    Dayton Jones, Mar 1, 2006, in forum: Perl Misc
    Replies:
    9
    Views:
    173
    Dayton Jones
    Mar 3, 2006
  5. MaggotChild

    File::Copy::copy With File Handles

    MaggotChild, Oct 18, 2011, in forum: Perl Misc
    Replies:
    2
    Views:
    490
    Ilya Zakharevich
    Oct 22, 2011
Loading...

Share This Page