Unexplained timeout when connecting to a windows share via Python - pysmb












0














I am using the below python code to connect to a windows remote share.



   self.connection = SMBConnection(
username=user,
password=password,
my_name=client_machine_name,
remote_name=server_name,
domain=domain,
use_ntlm_v2=True,
sign_options=2,
is_direct_tcp=True,
)

self.logger.info(
"Attempting to authenticate %s%s on %s", domain, user, server_name
)

self.connection.connect(server_name, 445)


The code is used by a daily script which was working fine until today, when it started timing out. What could be the reason?



nmap tells me that the port is open



Host is up (1.0s latency).      
Not shown: 988 closed ports
PORT STATE SERVICE
111/tcp open rpcbind
135/tcp open msrpc
139/tcp open netbios-ssn
161/tcp open snmp
445/tcp open microsoft-ds
1234/tcp open hotline
2049/tcp open nfs
5033/tcp open unknown
7777/tcp open cbt
8888/tcp open sun-answerbook
10000/tcp open snet-sensor-mgmt
12345/tcp open netbus


smbclient times out as well



bash$ smbclient -L xxx.xxx.xxx.xxx -U domain\user -d 5                          
INFO: Current debug levels:
all: 5
tdb: 5
printdrivers: 5
lanman: 5
smb: 5
rpc_parse: 5
rpc_srv: 5
rpc_cli: 5
passdb: 5
sam: 5
auth: 5
winbind: 5
vfs: 5
idmap: 5
quota: 5
acls: 5
locking: 5
msdfs: 5
dmapi: 5
registry: 5
scavenger: 5
dns: 5
ldb: 5
tevent: 5
auth_audit: 5
auth_json_audit: 5
kerberos: 5
drs_repl: 5
lp_load_ex: refreshing parameters
Initialising global parameters
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
INFO: Current debug levels:
all: 5
tdb: 5
printdrivers: 5
lanman: 5
smb: 5
rpc_parse: 5
rpc_srv: 5
rpc_cli: 5
passdb: 5
sam: 5
auth: 5
winbind: 5
vfs: 5
idmap: 5
quota: 5
acls: 5
locking: 5
msdfs: 5
dmapi: 5
registry: 5
scavenger: 5
dns: 5
ldb: 5
tevent: 5
auth_audit: 5
auth_json_audit: 5
kerberos: 5
drs_repl: 5
Processing section "[global]"
doing parameter workgroup = SAMBA
doing parameter security = user
doing parameter passdb backend = tdbsam
doing parameter printing = cups
doing parameter printcap name = cups
doing parameter load printers = yes
doing parameter cups options = raw
pm_process() returned Yes
added interface docker0 ip=xxx.xxx.xxx.xxx bcast=xxx.xxx.xxx.xxx netmask=xxx.xxx.xxx.xxx
added interface br-f26a4e627922 ip=xxx.xxx.xxx.xxx bcast=xxx.xxx.xxx.xxx netmask=xxx.xxx.xxx.xxx
added interface br-fc09ee069011 ip=xxx.xxx.xxx.xxx bcast=xxx.xxx.xxx.xxx netmask=xxx.xxx.xxx.xxx
added interface enp0s3 ip=xxx.xxx.xxx.xxx bcast=xxx.xxx.xxx.xxx netmask=xxx.xxx.xxx.xxx
Netbios name list:-
my_netbios_names[0]="LOCALHOST"
Client started (version 4.7.1).
Connecting to xxx.xxx.xxx.xxx at port 445
Connecting to xxx.xxx.xxx.xxx at port 139
Socket options:
SO_KEEPALIVE = 0
SO_REUSEADDR = 0
SO_BROADCAST = 0
TCP_NODELAY = 1
TCP_KEEPCNT = 9
TCP_KEEPIDLE = 7200
TCP_KEEPINTVL = 75
IPTOS_LOWDELAY = 0
IPTOS_THROUGHPUT = 0
SO_REUSEPORT = 0
SO_SNDBUF = 87040
SO_RCVBUF = 369280
SO_SNDLOWAT = 1
SO_RCVLOWAT = 1
SO_SNDTIMEO = 0
SO_RCVTIMEO = 0
TCP_QUICKACK = 1
TCP_DEFER_ACCEPT = 0
session request ok
protocol negotiation failed: NT_STATUS_IO_TIMEOUT









share|improve this question





























    0














    I am using the below python code to connect to a windows remote share.



       self.connection = SMBConnection(
    username=user,
    password=password,
    my_name=client_machine_name,
    remote_name=server_name,
    domain=domain,
    use_ntlm_v2=True,
    sign_options=2,
    is_direct_tcp=True,
    )

    self.logger.info(
    "Attempting to authenticate %s%s on %s", domain, user, server_name
    )

    self.connection.connect(server_name, 445)


    The code is used by a daily script which was working fine until today, when it started timing out. What could be the reason?



    nmap tells me that the port is open



    Host is up (1.0s latency).      
    Not shown: 988 closed ports
    PORT STATE SERVICE
    111/tcp open rpcbind
    135/tcp open msrpc
    139/tcp open netbios-ssn
    161/tcp open snmp
    445/tcp open microsoft-ds
    1234/tcp open hotline
    2049/tcp open nfs
    5033/tcp open unknown
    7777/tcp open cbt
    8888/tcp open sun-answerbook
    10000/tcp open snet-sensor-mgmt
    12345/tcp open netbus


    smbclient times out as well



    bash$ smbclient -L xxx.xxx.xxx.xxx -U domain\user -d 5                          
    INFO: Current debug levels:
    all: 5
    tdb: 5
    printdrivers: 5
    lanman: 5
    smb: 5
    rpc_parse: 5
    rpc_srv: 5
    rpc_cli: 5
    passdb: 5
    sam: 5
    auth: 5
    winbind: 5
    vfs: 5
    idmap: 5
    quota: 5
    acls: 5
    locking: 5
    msdfs: 5
    dmapi: 5
    registry: 5
    scavenger: 5
    dns: 5
    ldb: 5
    tevent: 5
    auth_audit: 5
    auth_json_audit: 5
    kerberos: 5
    drs_repl: 5
    lp_load_ex: refreshing parameters
    Initialising global parameters
    rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
    INFO: Current debug levels:
    all: 5
    tdb: 5
    printdrivers: 5
    lanman: 5
    smb: 5
    rpc_parse: 5
    rpc_srv: 5
    rpc_cli: 5
    passdb: 5
    sam: 5
    auth: 5
    winbind: 5
    vfs: 5
    idmap: 5
    quota: 5
    acls: 5
    locking: 5
    msdfs: 5
    dmapi: 5
    registry: 5
    scavenger: 5
    dns: 5
    ldb: 5
    tevent: 5
    auth_audit: 5
    auth_json_audit: 5
    kerberos: 5
    drs_repl: 5
    Processing section "[global]"
    doing parameter workgroup = SAMBA
    doing parameter security = user
    doing parameter passdb backend = tdbsam
    doing parameter printing = cups
    doing parameter printcap name = cups
    doing parameter load printers = yes
    doing parameter cups options = raw
    pm_process() returned Yes
    added interface docker0 ip=xxx.xxx.xxx.xxx bcast=xxx.xxx.xxx.xxx netmask=xxx.xxx.xxx.xxx
    added interface br-f26a4e627922 ip=xxx.xxx.xxx.xxx bcast=xxx.xxx.xxx.xxx netmask=xxx.xxx.xxx.xxx
    added interface br-fc09ee069011 ip=xxx.xxx.xxx.xxx bcast=xxx.xxx.xxx.xxx netmask=xxx.xxx.xxx.xxx
    added interface enp0s3 ip=xxx.xxx.xxx.xxx bcast=xxx.xxx.xxx.xxx netmask=xxx.xxx.xxx.xxx
    Netbios name list:-
    my_netbios_names[0]="LOCALHOST"
    Client started (version 4.7.1).
    Connecting to xxx.xxx.xxx.xxx at port 445
    Connecting to xxx.xxx.xxx.xxx at port 139
    Socket options:
    SO_KEEPALIVE = 0
    SO_REUSEADDR = 0
    SO_BROADCAST = 0
    TCP_NODELAY = 1
    TCP_KEEPCNT = 9
    TCP_KEEPIDLE = 7200
    TCP_KEEPINTVL = 75
    IPTOS_LOWDELAY = 0
    IPTOS_THROUGHPUT = 0
    SO_REUSEPORT = 0
    SO_SNDBUF = 87040
    SO_RCVBUF = 369280
    SO_SNDLOWAT = 1
    SO_RCVLOWAT = 1
    SO_SNDTIMEO = 0
    SO_RCVTIMEO = 0
    TCP_QUICKACK = 1
    TCP_DEFER_ACCEPT = 0
    session request ok
    protocol negotiation failed: NT_STATUS_IO_TIMEOUT









    share|improve this question



























      0












      0








      0







      I am using the below python code to connect to a windows remote share.



         self.connection = SMBConnection(
      username=user,
      password=password,
      my_name=client_machine_name,
      remote_name=server_name,
      domain=domain,
      use_ntlm_v2=True,
      sign_options=2,
      is_direct_tcp=True,
      )

      self.logger.info(
      "Attempting to authenticate %s%s on %s", domain, user, server_name
      )

      self.connection.connect(server_name, 445)


      The code is used by a daily script which was working fine until today, when it started timing out. What could be the reason?



      nmap tells me that the port is open



      Host is up (1.0s latency).      
      Not shown: 988 closed ports
      PORT STATE SERVICE
      111/tcp open rpcbind
      135/tcp open msrpc
      139/tcp open netbios-ssn
      161/tcp open snmp
      445/tcp open microsoft-ds
      1234/tcp open hotline
      2049/tcp open nfs
      5033/tcp open unknown
      7777/tcp open cbt
      8888/tcp open sun-answerbook
      10000/tcp open snet-sensor-mgmt
      12345/tcp open netbus


      smbclient times out as well



      bash$ smbclient -L xxx.xxx.xxx.xxx -U domain\user -d 5                          
      INFO: Current debug levels:
      all: 5
      tdb: 5
      printdrivers: 5
      lanman: 5
      smb: 5
      rpc_parse: 5
      rpc_srv: 5
      rpc_cli: 5
      passdb: 5
      sam: 5
      auth: 5
      winbind: 5
      vfs: 5
      idmap: 5
      quota: 5
      acls: 5
      locking: 5
      msdfs: 5
      dmapi: 5
      registry: 5
      scavenger: 5
      dns: 5
      ldb: 5
      tevent: 5
      auth_audit: 5
      auth_json_audit: 5
      kerberos: 5
      drs_repl: 5
      lp_load_ex: refreshing parameters
      Initialising global parameters
      rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
      INFO: Current debug levels:
      all: 5
      tdb: 5
      printdrivers: 5
      lanman: 5
      smb: 5
      rpc_parse: 5
      rpc_srv: 5
      rpc_cli: 5
      passdb: 5
      sam: 5
      auth: 5
      winbind: 5
      vfs: 5
      idmap: 5
      quota: 5
      acls: 5
      locking: 5
      msdfs: 5
      dmapi: 5
      registry: 5
      scavenger: 5
      dns: 5
      ldb: 5
      tevent: 5
      auth_audit: 5
      auth_json_audit: 5
      kerberos: 5
      drs_repl: 5
      Processing section "[global]"
      doing parameter workgroup = SAMBA
      doing parameter security = user
      doing parameter passdb backend = tdbsam
      doing parameter printing = cups
      doing parameter printcap name = cups
      doing parameter load printers = yes
      doing parameter cups options = raw
      pm_process() returned Yes
      added interface docker0 ip=xxx.xxx.xxx.xxx bcast=xxx.xxx.xxx.xxx netmask=xxx.xxx.xxx.xxx
      added interface br-f26a4e627922 ip=xxx.xxx.xxx.xxx bcast=xxx.xxx.xxx.xxx netmask=xxx.xxx.xxx.xxx
      added interface br-fc09ee069011 ip=xxx.xxx.xxx.xxx bcast=xxx.xxx.xxx.xxx netmask=xxx.xxx.xxx.xxx
      added interface enp0s3 ip=xxx.xxx.xxx.xxx bcast=xxx.xxx.xxx.xxx netmask=xxx.xxx.xxx.xxx
      Netbios name list:-
      my_netbios_names[0]="LOCALHOST"
      Client started (version 4.7.1).
      Connecting to xxx.xxx.xxx.xxx at port 445
      Connecting to xxx.xxx.xxx.xxx at port 139
      Socket options:
      SO_KEEPALIVE = 0
      SO_REUSEADDR = 0
      SO_BROADCAST = 0
      TCP_NODELAY = 1
      TCP_KEEPCNT = 9
      TCP_KEEPIDLE = 7200
      TCP_KEEPINTVL = 75
      IPTOS_LOWDELAY = 0
      IPTOS_THROUGHPUT = 0
      SO_REUSEPORT = 0
      SO_SNDBUF = 87040
      SO_RCVBUF = 369280
      SO_SNDLOWAT = 1
      SO_RCVLOWAT = 1
      SO_SNDTIMEO = 0
      SO_RCVTIMEO = 0
      TCP_QUICKACK = 1
      TCP_DEFER_ACCEPT = 0
      session request ok
      protocol negotiation failed: NT_STATUS_IO_TIMEOUT









      share|improve this question















      I am using the below python code to connect to a windows remote share.



         self.connection = SMBConnection(
      username=user,
      password=password,
      my_name=client_machine_name,
      remote_name=server_name,
      domain=domain,
      use_ntlm_v2=True,
      sign_options=2,
      is_direct_tcp=True,
      )

      self.logger.info(
      "Attempting to authenticate %s%s on %s", domain, user, server_name
      )

      self.connection.connect(server_name, 445)


      The code is used by a daily script which was working fine until today, when it started timing out. What could be the reason?



      nmap tells me that the port is open



      Host is up (1.0s latency).      
      Not shown: 988 closed ports
      PORT STATE SERVICE
      111/tcp open rpcbind
      135/tcp open msrpc
      139/tcp open netbios-ssn
      161/tcp open snmp
      445/tcp open microsoft-ds
      1234/tcp open hotline
      2049/tcp open nfs
      5033/tcp open unknown
      7777/tcp open cbt
      8888/tcp open sun-answerbook
      10000/tcp open snet-sensor-mgmt
      12345/tcp open netbus


      smbclient times out as well



      bash$ smbclient -L xxx.xxx.xxx.xxx -U domain\user -d 5                          
      INFO: Current debug levels:
      all: 5
      tdb: 5
      printdrivers: 5
      lanman: 5
      smb: 5
      rpc_parse: 5
      rpc_srv: 5
      rpc_cli: 5
      passdb: 5
      sam: 5
      auth: 5
      winbind: 5
      vfs: 5
      idmap: 5
      quota: 5
      acls: 5
      locking: 5
      msdfs: 5
      dmapi: 5
      registry: 5
      scavenger: 5
      dns: 5
      ldb: 5
      tevent: 5
      auth_audit: 5
      auth_json_audit: 5
      kerberos: 5
      drs_repl: 5
      lp_load_ex: refreshing parameters
      Initialising global parameters
      rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
      INFO: Current debug levels:
      all: 5
      tdb: 5
      printdrivers: 5
      lanman: 5
      smb: 5
      rpc_parse: 5
      rpc_srv: 5
      rpc_cli: 5
      passdb: 5
      sam: 5
      auth: 5
      winbind: 5
      vfs: 5
      idmap: 5
      quota: 5
      acls: 5
      locking: 5
      msdfs: 5
      dmapi: 5
      registry: 5
      scavenger: 5
      dns: 5
      ldb: 5
      tevent: 5
      auth_audit: 5
      auth_json_audit: 5
      kerberos: 5
      drs_repl: 5
      Processing section "[global]"
      doing parameter workgroup = SAMBA
      doing parameter security = user
      doing parameter passdb backend = tdbsam
      doing parameter printing = cups
      doing parameter printcap name = cups
      doing parameter load printers = yes
      doing parameter cups options = raw
      pm_process() returned Yes
      added interface docker0 ip=xxx.xxx.xxx.xxx bcast=xxx.xxx.xxx.xxx netmask=xxx.xxx.xxx.xxx
      added interface br-f26a4e627922 ip=xxx.xxx.xxx.xxx bcast=xxx.xxx.xxx.xxx netmask=xxx.xxx.xxx.xxx
      added interface br-fc09ee069011 ip=xxx.xxx.xxx.xxx bcast=xxx.xxx.xxx.xxx netmask=xxx.xxx.xxx.xxx
      added interface enp0s3 ip=xxx.xxx.xxx.xxx bcast=xxx.xxx.xxx.xxx netmask=xxx.xxx.xxx.xxx
      Netbios name list:-
      my_netbios_names[0]="LOCALHOST"
      Client started (version 4.7.1).
      Connecting to xxx.xxx.xxx.xxx at port 445
      Connecting to xxx.xxx.xxx.xxx at port 139
      Socket options:
      SO_KEEPALIVE = 0
      SO_REUSEADDR = 0
      SO_BROADCAST = 0
      TCP_NODELAY = 1
      TCP_KEEPCNT = 9
      TCP_KEEPIDLE = 7200
      TCP_KEEPINTVL = 75
      IPTOS_LOWDELAY = 0
      IPTOS_THROUGHPUT = 0
      SO_REUSEPORT = 0
      SO_SNDBUF = 87040
      SO_RCVBUF = 369280
      SO_SNDLOWAT = 1
      SO_RCVLOWAT = 1
      SO_SNDTIMEO = 0
      SO_RCVTIMEO = 0
      TCP_QUICKACK = 1
      TCP_DEFER_ACCEPT = 0
      session request ok
      protocol negotiation failed: NT_STATUS_IO_TIMEOUT






      python samba pysmb






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 23 at 8:00

























      asked Nov 23 at 7:48









      Dhruvan Ganesh

      966923




      966923





























          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53442565%2funexplained-timeout-when-connecting-to-a-windows-share-via-python-pysmb%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown






























          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53442565%2funexplained-timeout-when-connecting-to-a-windows-share-via-python-pysmb%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Contact image not getting when fetch all contact list from iPhone by CNContact

          count number of partitions of a set with n elements into k subsets

          A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks