pythonnetwork-programmingsshscpparamiko

a way to use Paramiko ssh / scp functionality from Unix to Windows or Windows to Windows?


is there a way to use Python paramiko package in order to scp or ssh from Unix to Windows or from Windows to Windows ?

It works very well from Windows to Unix and from Unix to Unix but not for the other configurations.

My code is

client = SSHClient()   
client.set_missing_host_key_policy(AutoAddPolicy())    
client.connect ('192.168.0.10', 22, 'username', 'pwd')  
transport = client.get_transport ()  
channel = transport.open_session ()  
channel.set_combine_stderr (True)  
channel.exec_command ("dir C:/")  

I get the following error message

Traceback (most recent call last):
File "paramiko_test_scp.py", line 50, in
client.connect ('192.168.0.10', 22, 'username', 'pwd')
File "C:\Python27\lib\site-packages\paramiko\client.py", line 291, in connect
sock.connect(addr)
File "C:\Python27\lib\socket.py", line 224, in meth
return getattr(self._sock,name)(*args)
socket.error: [Errno 10061]


Solution

  • Windows socket error 10061 means : no connection, target machine actively refused it. - Is your SSH server running (are you using OpenSSH ?) - Try to disable your firewall