0
votes

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]

1
I would guess the problem is, that on windows (by default) there is no SSH daemon which can take SSH connections. You need to run it there manually before you can use ssh/scp.ZeissS
@ZeissS Do you mean I need to install a SSH server tool on the PC I want to access... a tools like cygwin ?oaimac
Yes, you need a ssh server. Un*x/Linux contains one by default, but windows doesn't. I don't know whether cygwin contains a SSH Server.ZeissS

1 Answers

2
votes

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