rust-smb-server
SMB server in Rust.
Install
Or in Cargo.toml:
[]
= "0.6"
Run the example
Listens on 127.0.0.1:4445 and serves directories under smb-example in the system temp directory. Override with SMB_LISTEN and SMB_ROOT.
Shares: public (anon rw), media (anon ro), home (alice rw, bob ro).
alice and bob use the password in SMB_PASSWORD. Without it, the example generates one and logs it at startup.
Embed
use ;
let server = builder
.listen
.user
.share
.build?;
server.bind.await?;
server.serve.await?;
Runtime config
Create a ConfigHandle before serve() and keep it in the task that owns admin/config updates:
use ;
let server = builder
.listen
.share
.build?;
let config = server.config_handle;
config.add_user.await?;
let home = new
.user;
config
.add_share
.await?;
config.revoke_share_user.await?;
config.remove_user.await?;
server.serve.await?;
Removing a user revokes that user's active sessions. Removing a share or revoking share access closes matching active tree connections and open handles.
Limitations
Not supported:
- SMB3 encryption
- Kerberos; authentication is NTLM only
- oplocks, leases and durable handles
- change notifications
- named pipes and RPC, so clients can't list a server's shares
- DFS
- multichannel and compression
- alternate data streams and extended attributes
- network discovery (mDNS, NetBIOS, WS-Discovery): clients connect by name or address
License
MIT.