Skip to content

lucee/extension-smb

Repository files navigation

Lucee Extension SMB Resource Provider

Java CI

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.

Documentation

Usage

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/";

URL Format

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

Supported Operations

  • directoryCreate() / directoryDelete() / directoryExists() / directoryList()
  • fileRead() / fileWrite() / fileDelete() / fileExists()
  • fileCopy() / fileMove()
  • getFileInfo() / fileSetLastModified()

Configuration

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"
      }
    }
  ]
}

Available Options

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)

Security Recommendations

For modern environments, consider:

{
  "arguments": {
    "minVersion": "SMB300",
    "signingEnforced": "true",
    "encryptionEnabled": "true"
  }
}

This enforces SMB3+ with signing and encryption, which is the most secure configuration.

Requirements

  • Lucee 7.x or later
  • Java 17 or later

Technical Details

This extension uses jcifs-codelibs 3.0.0, a modern fork of the JCIFS library with SMB2/SMB3 support.

Issues

Lucee JIRA - SMB Issues

About

No description, website, or topics provided.

Resources

License

LGPL-2.1, LGPL-2.1 licenses found

Licenses found

LGPL-2.1
LICENSE
LGPL-2.1
License.txt

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published