Net::SCP download from windows to linux and encrypt password

K

Kalpesh Patel

I am using Net::SCP to download/upload file. I am doing like this...

----
require 'net/scp'
session = Net::SCP.start("10.10.10.10", "username", :password =>
"password", :config => false)
sess.download! "/tmp/test.txt", "/root/"
----

It works well when the source machine is linux and path is like
"/tmp/test.txt". What if the source machine is Windows? My path would be
something like "C:\temp\test.txt" but it does not work. It throws error
"No such file or directory". Any idea how can I do that?

Also, the password I give in the start function above is in plain text.
How can I encrypt it and pass it with the function?

Thanks much,
-Kalpesh
 
T

Tom Copeland

I am using Net::SCP to download/upload file. I am doing like this...

----
require 'net/scp'
session = Net::SCP.start("10.10.10.10", "username", :password =>
"password", :config => false)
sess.download! "/tmp/test.txt", "/root/"
----

It works well when the source machine is linux and path is like
"/tmp/test.txt". What if the source machine is Windows? My path would be
something like "C:\temp\test.txt" but it does not work. It throws error
"No such file or directory". Any idea how can I do that?

Check out Tempfile:

http://www.ruby-doc.org/stdlib/libdoc/tempfile/rdoc/classes/Tempfile.html

Yours,

Tom
 

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

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,038
Latest member
OrderProperKetocapsules

Latest Threads

Top