I have a python script to copy a file from an Ubuntu 22.04 host (ip 10.1.1.2) to a Windows host (member server on a domain, version 10.0.14393, ip 10.1.1.1) using pysmb. I have verified that the Windows host is available and that firewall rules are not blocking the request. The Windows host does not use port 139 so I'm trying to connect to 445 instead. The pysmb documentation implies that 445 can be used with is_direct_tcp=True as an argument.
My code:
from smb.SMBConnection import SMBConnection
conn = SMBConnection('username', 'password', 'ubuntuhost', 'windowshost', use_ntlm_v2 = True, is_direct_tcp=True)
conn.connect('10.1.1.1', port=445)
This code returns: [Errno 104] Connection reset by peer
The windows server event log reports:
The Windows Filtering Platform has permitted a connection. Application Information:
Process ID: 4
Application Name: System
Network Information:
Direction: Inbound
Source Address: 10.1.1.1
Source Port: 445
Destination Address: 10.1.1.2
Destination Port: 61296
Protocol: 6
Filter Information:
Filter Run-Time ID: 1576763
Layer Name: Receive/Accept
Layer Run-Time ID: 44
I've tried domain\username, username@domain, and username formats for the username with the same results. Any insights about the source of this error would be greatly appreciated.