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

**URL:** <https://www.ruby-forum.com/t/re-net-scp-download-from-windows-to-linux-and-encrypt-password/190880>\
**Category:** Ruby\
**Created:** [June 29, 2010, 8:15pm UTC](https://www.ruby-forum.com/t/re-net-scp-download-from-windows-to-linux-and-encrypt-password/190880 "2010-06-29T20:15:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![donv](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/0ea827/32.png) [@donv](https://www.ruby-forum.com/u/donv)\
**Post date:** [June 29, 2010, 8:15pm UTC](https://www.ruby-forum.com/t/re-net-scp-download-from-windows-to-linux-and-encrypt-password/190880/1 "2010-06-29T20:15:53Z")

</div>

Make sure your backslashes don’t generate tab characters. Use single  
quotes or escape the backlashes with extra backslash.

Sent from my HTC

----- Reply message -----  
From: “Kalpesh P.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Date: Tue, Jun 29, 2010 11:03  
Subject: Net::SCP download from windows to linux and encrypt password  
To: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

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

---

<div class="post-metadata">

**Author:** ![donv](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/0ea827/32.png) [@donv](https://www.ruby-forum.com/u/donv)\
**Post date:** [June 30, 2010, 9:16am UTC](https://www.ruby-forum.com/t/re-net-scp-download-from-windows-to-linux-and-encrypt-password/190880/2 "2010-06-30T09:16:21Z")

</div>

Thanks for the response. I wanted to know if I can use windows like  
path in SCP or not. Can I use something like â€œsess.download!  
â€™C:\myfile.jpgâ€™, â€˜/root/â€™â€? In fact, I tried this but it does not work.  
Any idea?

-Kalpesh

Uwe K. wrote:

> Make sure your backslashes don’t generate tab characters. Use single  
> quotes or escape the backlashes with extra backslash.
> 
> Sent from my HTC
> 
> ----- Reply message -----  
> From: “Kalpesh P.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> Date: Tue, Jun 29, 2010 11:03  
> Subject: Net::SCP download from windows to linux and encrypt password  
> To: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
> 
> 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
