pysmb icon indicating copy to clipboard operation
pysmb copied to clipboard

Cant connect w/ smb on mac os, python 3.8

Open davebeiler opened this issue 3 years ago • 6 comments

Successfully installed pysmb-1.2.7 (venv) s153152@MB20OXDHQ60774 ssd_dashboard % python3 smb2-connect-windows.py Traceback (most recent call last): File "smb2-connect-windows.py", line 16, in assert conn.connect(server_name, 139) AssertionError


import SmbClient, SMBConnection

class SmbClient(object):
        def __init__(self,ip,username,password,sharename):
                self.ip = 10.28.7.249
                self.username = 'username'
                self.password = 'password$'
                self.sharename = 'Tableau Output'
        def connect(self):
                self.server = SMBConnection(self.username,
                                self.password,client,netbios_name,use_ntlm_v2=True)
                self.server.connect(self.ip,139)

        def list(self):
                ' list files of remote share '
            filelist = self.server.listPath(self.sharename,'/')
            for f in filelist:
                    print f.filename

davebeiler avatar Feb 11 '22 22:02 davebeiler

same error on python 3.9

doesnt work either


        def connect(self):
                self.server = SMBConnection(self.username,
                self.password,client,netbios_name,use_ntlm_v2=True)
                assert self.server.connect(self.ip,139)
        def list(self):
                ' list files of remote share '
                filelist = self.server.listPath(self.sharename,'/')
                for f in filelist:
                        print f.filename

davebeiler avatar Feb 11 '22 22:02 davebeiler

@davebeiler : The netbios name might be incorrect or port 139 is behind firewall.

miketeo avatar Feb 12 '22 16:02 miketeo

No the documentation isn’t correct I was finally able to connect to it useing a better example

On Sat, Feb 12, 2022 at 8:43 AM Michael Teo @.***> wrote:

@davebeiler https://github.com/davebeiler : The netbios name might be incorrect or port 139 is behind firewall.

— Reply to this email directly, view it on GitHub https://github.com/miketeo/pysmb/issues/193#issuecomment-1037297724, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUMAOXULWRH52NNFGD3WER3U22E4HANCNFSM5OFOPDSQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>

davebeiler avatar Feb 12 '22 17:02 davebeiler

No the documentation isn’t correct

Can you point out where the documentation is not correct? It could help others in using pysmb.

miketeo avatar Feb 14 '22 14:02 miketeo

Hey @davebeiler, would you mind sharing the example you've used for connecting to your smb share on MacOS ?

praveen-elastic avatar Jun 24 '22 18:06 praveen-elastic

Try the version 1.2.8.

It MIGHT help if you, in fact, encountered the OpenSSL-related problem described here: https://github.com/miketeo/pysmb/issues/196

zentarim avatar Jul 07 '22 09:07 zentarim