---
title: dhconfig ACLs
sidebar_label: ACLs
---

The `acls` configuration data type of the [`dhconfig`](./overview.md) tool is used to add, remove and modify system access controls such as users, passwords, keys, and row/column ACLs. Authentication is required for most `acls` actions.

## Usage

Typical usage for the `acls` configuration data type is one of:

```text
dhconfig acls <action> [arguments]
dhconfig acls <subtype> <action> [arguments]
```

The first command is either a high-level ACL action (import or export) or an ACL subtype:

| Command / Subtype | Description              |
| ----------------- | ------------------------ |
| `import`          | Import ACLs from a file. |
| `export`          | Export ACLs to a file.   |
| `users`           | Manage users.            |
| `groups`          | Manage groups.           |
| `publickeys`      | Manage public keys.      |
| `rows`            | Manage row ACLs.         |
| `columns`         | Manage column ACLs.      |
| `inputtables`     | Manage input table ACLs. |
| `help`            | Show help information.   |

Each subtype has its own set of actions and arguments. As with other `dhconfig` configuration data types, the `--help` action provides detailed information on the available options and arguments, as well as usage examples, at every level of the `dhconfig acls` command. For a list of all available subtypes, run:

```bash
dhconfig acls --help
```

Which prints the following:

```text
dhconfig acls [import|export|users|groups|publickeys|rows|columns|inputtables|help] [arguments]
```

For more information about a specific subtype - for example, `users` - you can run:

```bash
dhconfig acls users --help
```

Which will return the following:

```text
dhconfig acls users [--configfile <arg>] [--diskprops] [--etcd] [-h] [-k <arg> | -user <arg>] [-pf <arg>]  [-v]
Supported subcommands [add|delete|list|remove-password|remove-runas|set-password|set-runas]
```

Finally, for more information about a specific action - for example, `add` - you can run:

```bash
dhconfig acls users add --help
```

Which will return the following:

```text
usage: dhconfig acls users add [--configfile <arg>] [--direct] [--diskprops] [--etcd] [-g <arg>] [-h] [--hashed-password
       <arg>] [-k <arg> | -user <arg>] [-n <arg>] [--new-key <arg>] [-pf <arg>]  [-v]
Create a  user.
```

A description of all the subcommand's options and some usage examples follows.

Due to the number of available options and combinations, an exhaustive list of all possible commands is not provided here. Instead, this guide presents some usage examples and recommends that you use the `--help` option as needed for more information.

## `export`

The `export` action exports the entire ACL database as an [XML](../../../data-guide/schemas/xml-schema-inference.md) file. Key arguments are:

| Option            | Description                                                                                                                                                                   |
| ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `-f,--file <arg>` | Name of the file to export to.                                                                                                                                                |
| `--type`          | Type of ACL to export. Allowed values: `passwd`, `columnacls`, `groupstrategy`, `inputtableeditors`, `strategyaccount`, `tableacls`, `usergroup`, `systemuser`, `publickeys`. |

**Example usage:**

```bash
dhconfig acls export --file /tmp/acls.xml
```

```bash
dhconfig acls export --file /tmp/acls.xml --type passwd --type publickeys
```

## `import`

The `import` action imports ACL data into the backing store. The action's arguments change how imported ACLs interact with existing ones. `import`'s arguments are extensively documented in dhconfig's `--help` output, so we will not repeat all of them here; however, there are some key arguments that are worth mentioning.

When handling existing ACLs, the following options are important:

| Option              | Description                                                                                                                                                                                                                                                                 |
| ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--ignore-existing` | Ignore existing entries and continue.                                                                                                                                                                                                                                       |
| `-o,--overwrite`    | Overwrite any existing entry.                                                                                                                                                                                                                                               |
| `--replace-all`     | Replace the entire ACL database with the imported ACL. When this option is set, all existing ACLs are removed and replaced with those in the import file. This is useful for restoring a known good state or migrating ACLs between environments. This requires `--direct`. |
|                     | If none of these options are set, the action will fail if there are any conflicting ACLS.                                                                                                                                                                                   |

Other important options include:

| Option                   | Description                                                                                                                                                                                                                                                                                                                |
| ------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--include-protected`    | Include protected keys in the import. If this is not set, special system users such as `iris`, `merge`, and `tdcp` will not be overwritten.                                                                                                                                                                                |
| `--protect-keys <arg>`   | Users to protect from public key import. System users specified by the `AclImporter.protectedUsers` are also protected unless `--include-protected` is set.                                                                                                                                                                |
| `--type`                 | Type of ACL to import. Allowed values: `passwd`, `columnacls`, `groupstrategy`, `inputtableeditors`, `strategyaccount`, `tableacls`, `usergroup`, `systemuser`, `publickeys`. The XML file might contain all the types. This will import only the specified type(s) and ignore the rest. Multiple values are allowed here. |
| `--continue-after-error` | Log and skip individual records that fail validation instead of aborting the entire import. See [Continue after error](#continue-after-error) below.                                                                                                                                                                       |

**Example usage:**

To replace the entire ACL database with the imported ACL, run:

```bash
dhconfig acls import --replace-all --file /tmp/acls.xml
```

## `users`

The `users` action lets you manage users of the system. It supports the following subcommands:

| Subcommand      | Description                          |
| --------------- | ------------------------------------ |
| add             | Add a user.                          |
| delete          | Remove a user.                       |
| list            | List users.                          |
| remove-password | Remove a user's password.            |
| remove-runas    | Remove a user's system user mapping. |
| set-password    | Set a user's password.               |
| set-runas       | Set a user's system user mapping.    |

...each of which has its own set of subcommands, which are documented in dhconfig's `--help` output. We won't go into detail on all of them here, but we will elaborate on some of the more complex subcommands.

### `add`

Add a user to the system.

| Argument                  | Description                                                                                                                                                                 |
| ------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `-n,--name <arg>`         | User name to create.                                                                                                                                                        |
| `-g,--group <arg> ...`    | Groups to add the user to. To specify multiple groups, list them as separate arguments (e.g., `--group G1 G2 G3`).                                                          |
| `--hashed-password <arg>` | The password for the user, hashed in apr1 format. Create a hashed password with `openssl passwd -apr1` (see [The --hashed-password option](#the---hashed-password-option)). |
| `--new-key <arg>`         | Path to a private key file to use for authentication.                                                                                                                       |

**Usage examples:**

Create a user with a private key:

```bash
dhconfig acls users add --name steven --new-key /path/to/keyfile
```

Create a user with a hashed password and add them to multiple groups:

```bash
dhconfig acls users add --name robert --hashed-password '$apr1$l.rU7lEZ$MbCXDfffKtFPDnSKSA0bG.' --group G1 G2 G3
```

### `delete`

Remove a normal user from the system. You cannot delete special system users such as `iris`, `merge`, and `tdcp`.

**Example usage:**

```bash
dhconfig acls users delete --name greg
```

### `list`

List users and their group memberships.

| Argument              | Description                                                                                                                     |
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| `-n,--name <arg> ...` | Users to display. To specify multiple users, list them as separate arguments (e.g., `--name user1 user2`).                      |
| `--include-run-as`    | Include the system user mapping for each user (see [set-runas](#deephaven-to-system-user-mappings-set-runas-and-remove-runas)). |

**Example usage:**

```bash
dhconfig acls users list
dhconfig acls users list --name robert bob charlie
```

### Continue after error

By default, the `import` action aborts on the first record that fails validation. The `--continue-after-error` flag changes this behavior so that invalid records are logged and skipped, allowing the rest of the import to proceed. A summary of all skipped records is printed at the end.

This is especially useful when continuously streaming ACL updates from a primary cluster into a secondary one, where some records in the source may not pass validation on the target. Three common scenarios are:

| Scenario                   | Description                                                                                                             | Example                                             |
| -------------------------- | ----------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------- |
| Non-ASCII account names    | Account names containing spaces, unicode, or other non-printable characters (often caused by copy-paste errors).        | `<user>0123456F 2</user>`                           |
| Invalid column ACLs        | Column ACL records using `*` as the column name, which was valid in older releases but is rejected in current versions. | `<column>*</column>`                                |
| User-name group membership | A group whose name matches an existing user has members assigned to it. This configuration is no longer permitted.      | User `xyz` exists, and the group `xyz` has members. |

**Example usage:**

Import ACLs from a file, skipping any records that already exist and any that fail validation:

```bash
dhconfig acls import --ignore-existing --continue-after-error --file /tmp/acls.xml
```

Import only password and user-group records, skipping invalid ones:

```bash
dhconfig acls import --ignore-existing --continue-after-error --type passwd --type usergroup --file /tmp/acls.xml
```

When records are skipped, the tool logs each error individually and prints a summary at the end:

```text
WARN  - SKIPPED record during password import: non-printable characters - user "0123456F 2"
WARN  - SKIPPED record during columnAcl import: invalid column name: * - allusers/Deere/AllTeams
...
WARN  - Import completed with 2 skipped record(s) due to errors:
WARN  -     - password import: non-printable characters - user "0123456F 2"
WARN  -     - columnAcl import: invalid column name: * - allusers/Deere/AllTeams
```

> [!NOTE]
> The `--continue-after-error` flag only affects validation errors for individual records. Structural errors in the XML file (such as malformed XML) or authentication failures will still cause the import to abort immediately.

### `set-password`

Set the password for a user. An authenticated user with sufficient permissions can set the password for any user. Any user can set their own password.

| Argument                  | Description                                                                                                                                                                                                                                              |
| ------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `-n,--name <arg>`         | User name to set the password for. Defaults to the authenticated user if omitted.                                                                                                                                                                        |
| `--hashed-password <arg>` | The new password, hashed in apr1 format. If omitted, you will be prompted to enter the new password on the command line. Create a hashed password with 'openssl passwd -apr1' (see [The --hashed-password option](#the---hashed-password-option) below.) |

> [!NOTE]
> The arguments to this command can be confusing.
>
> `--name` and `--hashed-password` specify the name of the _target_ user and the _new_ password for that user.
>
> `--user` and `--pwfile` specify the name and _current_ password of a user for [_authentication_](./overview.md#authentication) .
>
> The command will prompt for either or both passwords on the command line if you don't provide them as arguments.

#### The `--pwfile` option

This option is used to specify a file containing the base64-encoded current password for the user specified by the `--user` option.
This is one way to provide the required [authentication](./overview.md#authentication) for the `set-password` command.

```shell
echo -n the_password | base64 > /safe/location/pwfile.txt
```

#### The `--hashed-password` option

This option is used to specify the new password for the user specified by the `--name` option. The value is an [apr1-encoded password](https://httpd.apache.org/docs/2.4/misc/password_encryptions.html).

Note that the apr1 encoding can contain characters that will be interpreted by the shell. You can avoid this by enclosing the value in single quotes or storing it in a variable.

```bash
# Generate a hashed password and print it
openssl passwd -apr1 mynewpassword

# Generate a hashed password and store it in an environment variable
HASHED_PASSWORD=$(openssl passwd -apr1 mynewpassword)
```

#### Examples

Set the password for user `targetUser`. This command will prompt for `adminuser`'s password and then the new password for `targetUser`.

```bash
/usr/illumon/latest/bin/dhconfig acls users set-password --name targetUser --user adminuser
```

Set the password for user `targetUser`. This command will authenticate using the private key for `iris` and will prompt for the new password for `targetUser`.

```bash
sudo -u irisadmin /usr/illumon/latest/bin/dhconfig acls users set-password --name targetUser
```

Set the password for user `targetUser`. This command provides all the required passwords on the command line.

```bash
/usr/illumon/latest/bin/dhconfig acls users set-password --name targetUser --hashed-password $HASHED_PASSWORD --user adminuser --pwfile /safe/location/pwfile.txt
```

Set the password for your own user. This command will prompt for your current password and then the new password.

```bash
/usr/illumon/latest/bin/dhconfig acls users set-password --user myusername
```

> [!WARNING]
> Some of the examples above leave the plaintext password in shell history. It is more secure to use only the options that read sensitive information from files or the command line.

### Deephaven-to-system user mappings: `set-runas` and `remove-runas`

In some environments, it is necessary for a Deephaven user to execute processes or queries as a specific system user on the host operating system. This mapping allows administrators to specify which system account should be used when a given Deephaven user initiates certain actions, such as running Persistent Queries (PQs) or other privileged tasks. This is typically managed using the `set-runas` and `remove-runas` subcommands. The mapping is also visible using the `--include-run-as` option with the `list` subcommand.

The `set-runas` command maps a Deephaven user to a specific system (OS-level) user account. This mapping determines which system user identity is used when the Deephaven user initiates certain privileged operations, such as running Persistent Queries (PQs) or other tasks that require elevated or audited access on the host machine.

By default, privileged operations launched by Deephaven may run as the same user that started the Deephaven service. However, with `set-runas`, you can configure the system so that actions performed by a particular Deephaven user are instead executed as a designated system user. This is especially useful in environments with strict security, compliance, or auditing requirements, where it is important to control and track which system accounts are used for sensitive operations.

**Typical use cases include:**

- Ensuring that actions requiring access to restricted files or services are performed under the appropriate system user account.
- Enabling more granular auditing by associating system-level actions with individual Deephaven users.
- Complying with organizational policies that require separation of privileges or user accountability.

**Example usage:**

```bash
/usr/illumon/latest/bin/dhconfig acls users set-runas --name dh_user --system-user sys_user
```

This command configures the Deephaven user `dh_user` so that any privileged operation they initiate will run as the system user `sys_user`.

**Options:**

| Option                | Description                                  |
| --------------------- | -------------------------------------------- |
| `-n,--name <arg>`     | Deephaven user name to create a mapping for. |
| `--system-user <arg>` | The system (OS) user to run operations as.   |

## `groups`

The `groups` action lets you manage groups. This action has several subcommands:

| Subcommand    | Description                           |
| ------------- | ------------------------------------- |
| add-member    | Add a user to one or more groups.     |
| delete        | Delete one or more groups.            |
| list          | List the groups.                      |
| remove-member | Remove users from one or more groups. |

The options for each subcommand are detailed in dhconfig's `--help` output.

### `add-member`

To add `user1` and `user2` to groups `G1`, `G2`, and `G3`, run:

```bash
dhconfig acls groups add-member --name user1 user2 --group G1 G2 G3
```

### `delete`

To delete groups `G2` and `G3`, run:

```bash
dhconfig acls groups delete --group G2 G3
```

### `list`

To list all groups, run:

```bash
dhconfig acls groups list
```

### `remove-member`

To remove `user1` and `user2` from groups `G1` and `G5`, run:

```bash
dhconfig acls groups remove-member --name user1 user2 --group G1 G5
```

## `publickeys`

The `publickeys` action lets you manage [public keys](../public-and-private-keys.md) for users.

### `list`

List public keys for users. By default, the output is a table showing truncated keys. If you specify `--csv` or `--file`, the output will include the full public key. Use the `--include-hash` option to add a unique hash value for each key, which can be used with the `delete` subcommand.

| Argument              | Description                                                                                                         |
| --------------------- | ------------------------------------------------------------------------------------------------------------------- |
| `--include-hash`      | Include an identifying hash for use with `acls publickeys delete`.                                                  |
| `-n,--name <arg> ...` | Users to display keys for. To specify multiple users, list them as separate arguments (e.g., `--name user1 user2`). |

**Example usage:**

```bash
dhconfig acls publickeys list
dhconfig acls publickeys list --name robert bob charlie --include-hash
```

### `import`

Import a public key. `--file` may be a Deephaven public key file, private key file, or a file containing a list of keys to be added as `user publickey` pairs. Use `--ignore-existing` to skip any keys that already exist.

```bash
dhconfig acls publickeys import --file /path/to/publickeyfile --ignore-existing
```

### `delete`

Delete a public key. You may use the `--file` option to delete a public key identified by the specified key file, or the `--hash` option to remove a key based on the hash provided by `list`.

```bash
dhconfig acls publickeys delete --hash <hash>
```

## `rows`, `columns`, and `inputtables`

The actions `rows`, `columns`, and `inputtables` may be used to manage table-level ACLs.

**Example usage:**

Add a row ACL for the `Asia` group to the `Trades` table in the `Market` namespace:

```bash
dhconfig acls rows add --namespace Market --table-name Trades --group Asia --acl "new GroupFilterGenerator()"
```

Delete a column ACL for the `Desk` group from the `Trades` table in the `Market` namespace:

```bash
dhconfig acls columns delete --namespace Market --table-name Trades --group Desk --columns Price Size
```

List all input table ACLs:

```bash
dhconfig acls inputtables list
```

## Related documentation

- [dhconfig overview](./overview.md)
- [Access Control List](../../permissions/permissions-overview.md)
- [Authentication](./overview.md#authentication)
- [Public and private keys](../public-and-private-keys.md)
