FUSE filesystem backed by smbclient (smbprotocol)
Project description
smb-pyfuse
Mount SMB/CIFS shares as local directories using FUSE.
Built on top of smbprotocol and fuse-python, smb-pyfuse exposes a remote SMB share as a regular filesystem — supporting reads, writes, directory listing, symlinks, and more.
Features
- Mount any SMB2/SMB3 share as a local directory
- Username/password and Kerberos authentication
- Optional SMB3 encryption
- Foreground and background (daemon) modes
allow_other/allow_rootFUSE mount options- Programmatic Python API (
mount,unmount,SmbFuseFS)
Supported FUSE Operations
| Operation | Description |
|---|---|
getattr |
File/directory metadata (stat) |
readdir |
List directory contents |
mkdir / rmdir |
Create / remove directories |
rename |
Rename files or directories |
unlink |
Delete a file |
mknod |
Create a new regular file |
open / read / write / release |
File I/O |
truncate / ftruncate |
Truncate a file |
flush / fsync |
Flush / sync file data |
symlink / readlink / link |
Symbolic and hard links |
utime |
Update access/modification times |
chmod / chown |
No-op (silently succeeds for tool compatibility) |
access |
Existence check via stat |
statfs |
Returns sensible defaults |
Prerequisites
System Dependencies
sudo apt install libkrb5-dev build-essential python3-dev
FUSE
FUSE must be available on the host:
# Debian / Ubuntu
sudo apt install fuse3 libfuse-dev
# To allow non-root users to use allow_other:
# Uncomment 'user_allow_other' in /etc/fuse.conf
Installation
# Clone the repo
git clone https://github.com/<your-org>/smb-pyfuse.git
cd smb-pyfuse
# Install with uv (recommended)
uv sync --frozen
# Or with pip
pip install .
Usage
CLI
Mount a share (foreground mode):
uv run main.py mount /mnt/smb myserver.example.com myshare -u 'DOMAIN\user' -p 'password' -f
Mount with Kerberos (requires a valid TGT in the credential cache):
kinit user@REALM
uv run main.py mount /mnt/smb myserver.example.com myshare --kerberos -f
Mount in the background (daemon mode):
uv run main.py mount /mnt/smb myserver.example.com myshare -u user -p pass
Unmount:
uv run main.py unmount /mnt/smb
CLI Options
positional arguments:
mountpoint Local directory to mount the share at
server SMB server hostname or IP address
share Share name (without backslashes)
options:
-u, --username SMB username
-p, --password SMB password
--port SMB TCP port (default: 445)
--kerberos Authenticate with Kerberos TGT
--encrypt Request SMB3 encryption
--connection-timeout TCP connection timeout in seconds (default: 60)
-f, --foreground Run in foreground (block until unmounted)
--allow-other Allow other users to access the mount
--allow-root Allow root to access the mount
-v, --verbose Enable debug logging
Python API
from smb_pyfuse import mount, unmount
# Mount (blocks in foreground mode)
mount(
mountpoint="/mnt/smb",
server="myserver.example.com",
share="myshare",
username="alice",
password="s3cr3t",
foreground=True,
)
# Unmount
unmount("/mnt/smb")
Or use the filesystem class directly:
from smb_pyfuse import SmbFuseFS
fs = SmbFuseFS(
server="myserver.example.com",
share="myshare",
username="alice",
password="s3cr3t",
)
fs.fuse_args.mountpoint = "/mnt/smb"
fs.fuse_args.add("allow_other")
fs.main()
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file smb_pyfuse-0.3.0.tar.gz.
File metadata
- Download URL: smb_pyfuse-0.3.0.tar.gz
- Upload date:
- Size: 10.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6748b0a47da927fdf8d8c5758fed871728e5ba06dcce73dcbce00c2dde8a9e9f
|
|
| MD5 |
9cb7095d0c44c42cf58dc29ac30c797a
|
|
| BLAKE2b-256 |
d19aef9e1812f9b9386e44340a484d5256a48a5ff395bc0318ed60073cac733f
|
File details
Details for the file smb_pyfuse-0.3.0-py3-none-any.whl.
File metadata
- Download URL: smb_pyfuse-0.3.0-py3-none-any.whl
- Upload date:
- Size: 11.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3808f9a504acccc70fc2c81be123e94a0d1dc9883f43bbfa8dd874f95ebd3400
|
|
| MD5 |
6dbdaea7ec780c2b90525a590e0cc3c5
|
|
| BLAKE2b-256 |
cb370bc7f96847b5a0bb46de7e92efec92a47daac1d5206473f56fdcf0b3bf6a
|