-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Randomly getting a SMBAuthenticationError #287
Comments
Are you by chance using Kerberos auth in your test environment? Have you set any credentials with the |
Hello, no, i don´t use Kerberos.
I will try giving ntlm as the auth_protocol in the register_session method, maybe it will help. Unfortunately i will have to wait a week to give some feedback :/ Cheers |
Hey, it did not fix the problem. Sadly. Any other ideas? Cheers |
In your stacktrace I can see that the entrypoint into this module is the below with just the smbclientpath.exists(path) This ultimately leads into get_smb_tree being called with the One of the extra checks that the connection cache does is check if the connection transport is connected. My guess is that after 7 days, the server is going to reset the TCP socket causing the smbclient connection thread to detect the connection is closed and mark it so. The next time that connection is used in What you can do is set the username/password as the default value to use for all enw connections and just remove the import smbclient
# Registers the global user/pass to use for all connections
smbclient.ClientConfig(username=username, password=password)
while True:
...
smbclientpath.exists(path) In the above case when the connection is closed after 7 days, the new connection will automatically use the username/password provided on the client config rather than none at all. |
Hey, sorry for the late response. No more errors. But one more question. Let´s say: With the register_session i was able to register multiple sessions for that smbclient. Cheers |
You cannot, the only safe way of doing that is to provide explicit credentials in the actual SMB function, in your case ‘smbclient.path.exists(path, username=username, password=password)`. Anything else is either a global setting or prone to this problem where a session is dropped over time. |
Hello,
firstly, great lib.
But we kinda face a problem we can't identify...
So let me give u some context.
We have a python script running inside a docker container observing a local directory inside that container. If something goes in that directory, the script does different things. That script observes that directory 24/7 and one
action
is to copy the content of that local directory to an SMB share (Win 2k16 File Server). That whole process works like charm for exactly 7 days. After 7 days, we receive the following error/s in our logs...Extracted traceback
The script continues running but throws that error over and over again. I have to restart the container, and it works again for the next 7 days...
Script runs with python version 3.12, smbprotocol version is 1.13.0
Now the weird part..
We have another python script running inside a container doing literally the same thing as described above. Copying a local file to a SMB share. But this script runs with python version 3.10 and smbprotocol 1.9.0. But here we don't have this problem.
Anyone else having this problem?
The text was updated successfully, but these errors were encountered: