This extension provides SMB (Server Message Block) / CIFS (Common Internet File System) virtual file system support for Lucee, allowing you to read, write, and manipulate files on Windows network shares and Samba servers using standard CFML file functions.
Access SMB shares using the smb:// scheme with standard CFML file functions:
// Basic usage with credentials in URL
smbPath = "smb://username:password@server/share/path/";
// Check if directory exists
if ( directoryExists( smbPath ) ) {
// List files
files = directoryList( smbPath );
// Read a file
content = fileRead( smbPath & "document.txt" );
// Write a file
fileWrite( smbPath & "output.txt", "Hello SMB!" );
}
// With domain authentication
smbPath = "smb://DOMAIN;username:password@server/share/";smb://[domain;]username:password@host[:port]/share/path/
- domain - Optional Windows domain
- username - SMB username
- password - SMB password
- host - Server hostname or IP
- port - Optional port (default: 445)
- share - Share name
- path - Path within the share
directoryCreate()/directoryDelete()/directoryExists()/directoryList()fileRead()/fileWrite()/fileDelete()/fileExists()fileCopy()/fileMove()getFileInfo()/fileSetLastModified()
The extension works out of the box with sensible defaults. To customise the SMB settings, add arguments to your .CFConfig.json:
{
"resourceProviders": [
{
"scheme": "smb",
"class": "org.lucee.extension.resource.smb.SMBResourceProvider",
"arguments": {
"minVersion": "SMB202",
"signingPreferred": "true"
}
}
]
}| Option | Default | Description |
|---|---|---|
minVersion |
SMB1 |
Minimum SMB protocol version: SMB1, SMB202, SMB210, SMB300, SMB302, SMB311 |
maxVersion |
SMB311 |
Maximum SMB protocol version |
soTimeout |
35000 |
Socket timeout in milliseconds |
connTimeout |
35000 |
Connection timeout in milliseconds |
responseTimeout |
30000 |
SMB response timeout in milliseconds |
signingPreferred |
false |
Prefer SMB signing when available |
signingEnforced |
false |
Require SMB signing (fails if server doesn't support it) |
encryptionEnabled |
false |
Enable SMB3 encryption |
dfsDisabled |
true |
Disable DFS (Distributed File System) lookups |
resolveOrder |
DNS |
Name resolution order (e.g., DNS, LMHOSTS,DNS,WINS,BCAST) |
For modern environments, consider:
{
"arguments": {
"minVersion": "SMB300",
"signingEnforced": "true",
"encryptionEnabled": "true"
}
}This enforces SMB3+ with signing and encryption, which is the most secure configuration.
- Lucee 7.x or later
- Java 17 or later
This extension uses jcifs-codelibs 3.0.0, a modern fork of the JCIFS library with SMB2/SMB3 support.