> ## Documentation Index
> Fetch the complete documentation index at: https://knowledge.cloudquant.com/llms.txt
> Use this file to discover all available pages before exploring further.

# CIFS/SMB

> Configure Windows/Samba network share datasources

# CIFS/SMB

CIFS/SMB datasources allow CloudQuant Data Liberator to read CSV, TSV, and other delimited files from Windows file shares or Samba servers. This is commonly used in enterprise environments where data is published to shared network drives.

<Note>
  See [Supported Data Formats](/datasource-config/supported-formats) for every file extension Liberator can ingest from CIFS/SMB shares, including formats added in 2.1 and 2.2.
</Note>

## Connection configuration

### Required fields

| Field      | Type   | Description                                                            |
| ---------- | ------ | ---------------------------------------------------------------------- |
| `username` | string | Windows/Samba domain username                                          |
| `password` | string | Password for authentication                                            |
| `server`   | string | Server hostname or IP address                                          |
| `path`     | string | UNC path to the share (e.g., `"sharename"` or `"sharename/subfolder"`) |

<Note>
  The `connection_type` for CIFS/SMB connections is inferred from the presence of the `server` and `path` fields. Unlike other connection types, there is no explicit `connection_type` field required.
</Note>

### Optional fields

| Field    | Type   | Default | Description                                  |
| -------- | ------ | ------- | -------------------------------------------- |
| `prefix` | string | `""`    | Subdirectory within the share to use as root |

### Example connection

```json theme={null}
{
  "name": "cifs-shared-drive",
  "username": "DOMAIN\\datauser",
  "password": "w1nd0wsP@ss",
  "server": "fileserver.corp.example.com",
  "path": "MarketData",
  "prefix": "daily/equities/"
}
```

<Warning>
  Use a dedicated service account with read-only permissions on the share. Avoid using personal credentials, as password changes would break the connection.
</Warning>

### Domain authentication

For Active Directory environments, include the domain in the username:

```json theme={null}
{
  "username": "CORP\\svc-liberator"
}
```

Or use the UPN format:

```json theme={null}
{
  "username": "svc-liberator@corp.example.com"
}
```

## Dataset configuration (data\_args)

The `data_args` fields are identical to all file-based sources. See [Local File](/datasource-config/local-file) for the full reference. The `file_pattern` is evaluated relative to the `prefix` configured on the connection.

### Required data\_args

| Field             | Type           | Description                                                         |
| ----------------- | -------------- | ------------------------------------------------------------------- |
| `file_pattern`    | string         | Glob pattern relative to the prefix, e.g., `"*.csv"`                |
| `data_dt_column`  | string or list | Column(s) containing the datetime value                             |
| `data_dt_format`  | string or list | strptime format or special values (`"muts"`, `"uts"`, `"datetime"`) |
| `data_key_column` | string or list | Symbol/key column(s)                                                |

### Optional data\_args

| Field                     | Type   | Default              | Description                              |
| ------------------------- | ------ | -------------------- | ---------------------------------------- |
| `sep_override`            | string | `","`                | Delimiter character                      |
| `encoding`                | string | `"utf-8"`            | File encoding                            |
| `data_dt_timezone`        | string | `"UTC"`              | Source data timezone                     |
| `fname_dt_regex`          | string |                      | Regex to extract date from filename      |
| `fname_dt_format`         | string |                      | strptime format for filename date        |
| `fname_dt_timezone`       | string |                      | Timezone of filename date                |
| `fname_dt_nudge`          | int    | `0`                  | Microsecond offset for filename date     |
| `fname_dt_approx_seconds` | int    |                      | Approximate seconds per file             |
| `arrow_sort`              | list   | `["symbol", "muts"]` | Sort order                               |
| `arrow_timestamp`         | bool   | `true`               | Generate human-readable timestamp column |

## Complete example

### Connection

```json theme={null}
{
  "name": "cifs-risk-reports",
  "username": "CORP\\svc-liberator",
  "password": "s3rv1ceAcct!",
  "server": "nas01.corp.example.com",
  "path": "RiskReports",
  "prefix": "daily/"
}
```

### Dataset

```json theme={null}
{
  "name": "daily-risk-metrics",
  "connection": "cifs-risk-reports",
  "data_args": {
    "file_pattern": "risk_*.csv",
    "sep_override": ",",
    "encoding": "utf-8",
    "data_dt_column": "report_date",
    "data_dt_format": "%Y-%m-%d",
    "data_dt_timezone": "America/New_York",
    "data_key_column": "portfolio_id",
    "fname_dt_regex": "risk_(\\d{8})\\.csv",
    "fname_dt_format": "%Y%m%d",
    "fname_dt_timezone": "America/New_York",
    "fname_dt_approx_seconds": 86400,
    "arrow_sort": ["symbol", "muts"],
    "arrow_timestamp": true
  },
  "schema": [
    { "name": "portfolio_id", "type": "string", "group": "key", "description": "Portfolio identifier" },
    { "name": "report_date", "type": "string", "group": "time", "description": "Report date" },
    { "name": "var_95", "type": "double", "group": "value", "description": "95th percentile VaR" },
    { "name": "var_99", "type": "double", "group": "value", "description": "99th percentile VaR" },
    { "name": "cvar", "type": "double", "group": "value", "description": "Conditional VaR" },
    { "name": "beta", "type": "double", "group": "value", "description": "Portfolio beta" },
    { "name": "sharpe", "type": "double", "group": "value", "description": "Sharpe ratio" }
  ]
}
```

## Network requirements

| Requirement        | Detail                                                                   |
| ------------------ | ------------------------------------------------------------------------ |
| **Outbound port**  | TCP port 445 (SMB) to the file server                                    |
| **DNS resolution** | The server hostname must resolve from the CloudQuant Data Liberator host |
| **Authentication** | NTLM or Kerberos (depending on domain configuration)                     |
| **SMB version**    | SMB 2.0 or higher recommended; SMBv1 is deprecated and insecure          |

<Tip>
  If the CloudQuant Data Liberator host is Linux-based, install `cifs-utils` for CIFS mount support.
</Tip>

<CodeGroup>
  ```bash Debian/Ubuntu theme={null}
  apt install cifs-utils
  ```

  ```bash RHEL/CentOS theme={null}
  yum install cifs-utils
  ```
</CodeGroup>

## Troubleshooting

| Issue                                | Possible Cause                                          | Solution                                                                                             |
| ------------------------------------ | ------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
| Mount fails with "Permission denied" | Incorrect credentials or insufficient share permissions | Verify credentials and ensure the service account has read access to the share                       |
| Mount fails with "Host is down"      | Network connectivity or firewall blocking port 445      | Check firewall rules and verify SMB port is reachable                                                |
| Files not found                      | Incorrect `path` or `prefix`                            | Verify the UNC path using `smbclient` or Windows Explorer                                            |
| Encoding errors                      | Files use non-UTF-8 encoding                            | Set `encoding` in data\_args (common alternatives: `"latin-1"`, `"cp1252"` for Windows-origin files) |
