smbprotocol
Interact with a server using the SMB 2/3 Protocol
What it is and what it does
smbprotocol is a Python client library that implements the SMBv2 and SMBv3 network protocols, allowing your code to connect to and interact with Windows file shares, network printers, and other SMB-enabled resources. It negotiates protocol versions from SMB 2.0.2 up to SMB 3.1.1 (Windows 10/Server 2016 level) and handles authentication via NTLM or Kerberos, message signing, and encryption for SMBv3 connections.
The library offers two interfaces: a low-level protocol API for fine-grained control and a higher-level interface that mirrors Python's built-in os and os.path functions for simpler file operations. Connections are pooled and DFS referrals are cached, making it suitable for everyday file-sharing tasks without verbose boilerplate.
Use it for:
- Access and manage files on Windows network shares from Linux or macOS without mounting SMB volumes.
- Automate backup or synchronization of files from remote SMB servers in Python scripts.
- Build cross-platform file management tools that work with network-shared files using the higher-level interface.
- Authenticate to corporate SMB servers using Kerberos in domain environments.
- Read or write files on network printers and other SMB-enabled devices programmatically.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
SMBv2 and SMBv3 client library for Python that enables reading, writing, and managing files on remote SMB/CIFS network shares with support for NTLM and Kerberos authentication.
Yes. The package is actively maintained, has no known vulnerabilities, low install friction, and a permissive MIT license. It fills a genuine need for SMB protocol support in Python with both simple and advanced interfaces. Install it if you need to interact with Windows file shares or other SMB resources from Python; the main gotcha is the Python 3.10+ requirement and optional Kerberos setup on Linux.
Install
smbprotocol on PyPI
pip
pip install smbprotocoluv
uv add smbprotocolpoetry
poetry add smbprotocolInstalling smbprotocol
Before you install
Low install friction with a pure-Python wheel and only two runtime dependencies (cryptography and pyspnego). Actively maintained with last commit 2026-07-07. Kerberos support on Linux requires optional system libraries, but basic NTLM authentication works without them.
License in practice
MIT license is permissive and places no restrictions on use, modification, or distribution in commercial or private projects.
Quickstart
pip install smbprotocol
from smbprotocol.connection import Connection, Dialects
import uuid
connection = Connection(uuid.uuid4(), "server", 445)
connection.connect(Dialects.SMB_3_0_2)
Requires Python 3.10 or later. Kerberos authentication on Linux requires additional system packages (libkrb5-dev) and python-gssapi; Windows Kerberos works out of the box via pyspnego.
Verify before relying
- Whether DFS (Distributed File System) support is production-ready or still experimental as described in the excerpt.
- Performance characteristics and scalability limits for concurrent connections or large file transfers.
- Whether all SMB 3.1.1 features are fully implemented or if there are known gaps beyond the backlog mentioned.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — cryptography, pyspnego |
| Maintenance | actively maintained — 38 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 12,507,553/month — #1,315 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: smbprotocol-1.17.0-py3-none-any.whl
Keywords: smb, smb2, smb3, cifs, python
Tags
More Networking packages
h11 is a pure-Python HTTP/1.1 protocol…
permissive · top 100 on PyPI
psutilpsutil retrieves real-time information about…
permissive · top 1,000 on PyPI
pyOpenSSLpyOpenSSL wraps OpenSSL's SSL/TLS functionality…
permissive · top 1,000 on PyPI
uvloopuvloop is a drop-in replacement for Python's…
permissive · top 1,000 on PyPI
execnetexecnet lets you spawn and communicate with…
permissive · top 1,000 on PyPI
pyzmqPyZMQ provides Python bindings for ZeroMQ…
permissive · top 1,000 on PyPI
pysmbpysmb implements the SMB/CIFS protocol to let…
permissive · top 5,000 on PyPI
pyspnegoHandles SPNEGO, NTLM, Kerberos, and CredSSP…
permissive · top 1,000 on PyPI
impacketImpacket provides low-level Python classes for…
permissive · top 15,000 on PyPI
apache-airflow-providers-sambaIntegrates Samba file-sharing protocol with…
permissive · top 15,000 on PyPI
pypsexecRuns commands on remote Windows hosts via…
permissive · top 15,000 on PyPI
requests-credsspAdds CredSSP authentication support to the…
permissive · top 15,000 on PyPI
azure-storage-file-shareInteract with Azure File Share storage—create,…
permissive · top 5,000 on PyPI
pypsrpExecute commands, scripts, and file operations…
permissive · top 5,000 on PyPI
pywinrmpywinrm is a Python client for Windows Remote…
permissive · top 5,000 on PyPI
msldapmsldap is a Python library for querying and…
permissive · top 15,000 on PyPI