I am trying to connect my windows 10 pc with raspberry pi 2 using python script. What I want to do: I want to download the file from windows 10 machine with the help of python Script from raspberry pi. I dont want to use ftp.

What I am doing: I have written the code using paramiko. Below are my code.

import os

import paramiko

host = ""                    
port = 22
transport = paramiko.Transport((host, port))

password = "mypassword"                
username = "myusername"                        
transport.connect(username = username, password = password)

sftp = paramiko.SFTPClient.from_transport(transport)

But I am not able to connect only. Its saying connection refused error.

Note: I have connected locally from pi as well as windows means both systems are in same network.

Please help me to resolve this?

  • Can you connect using ssh or sftp from the command line? You really only get one chance to get your question seen, you need to make sure you include all relevant detail up front rather than just in response to comments. – joan Jul 24 '18 at 8:07
  • There isn't a ssh, scp nor sftp service running on a default MS-Windows installation. You have to install and enable those first. – Janka Jul 24 '18 at 8:35
  • I am trying to connect using ssh or sftp from the command line also but not able to do so. – Rohit Jul 24 '18 at 8:58
  • Hi Janka Can you let me know how to do that. – Rohit Jul 24 '18 at 8:59
  • If you want to use SSH - first install the "windows 10 built in openssh server" - hint that's what you need to search for on the intergoogles – Jaromanda X Jul 24 '18 at 9:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.