TrueNAS SCALETrueNAS SCALE Nightly Development Documentation
This content follows experimental early release software. Use the Product and Version selectors above to view content specific to a stable software release.

Directory Service

The TrueNAS CLI guide for SCALE is a work in progress! New namespace and command documentation is continually added and maintained, so check back here often to see what is new!

Welcome to the TrueNAS SCALE Command Line Interface (CLI) guide!

The TrueNAS CLI in TrueNAS SCALE functions like a text-based version of the web UI with many functional areas grouped into parent and child namespaces that mirror the counterparts in the SCALE UI.

The underlying structure of the CLI namespaces and commands closely follows that of the SCALE API. For more information on API commands, arguments, options, and definitions go to API Keys and click on API Docs in the SCALE UI.

Directory_Service Commands

The directory_service namespace has two commands and four child namespaces and is based on functions found in the SCALE API and web UI. It provides access to directory service methods. The four child namespaces have their own commands.

You can enter commands from the main CLI prompt or from the directory_service namespace prompt.

Cache_Refresh Command

The cache_refresh command refreshes the directory services cache for users and groups. The user query and group query commands use this cache. The first cache file in an Active Directory domain might take a significant amount of time to complete, so it is performed within a job. Refresh the cache after adding new users or groups to a remote directory server to have the users or groups appear in the results. A cache refresh is not required to use newly-added users and groups for permissions and ACL related methods. It also does not resolve issues with users that cannot authenticate to shares.

Using Cache_Refresh

Description

The cache_refresh command displays the status of the cache-refresh process in percentage complete. This command does not require entering properties or arguments. Enter the command, then press Enter. The cache_refresh command returns the status of the refresh in percentage complete.

Usage

From the CLI prompt, enter:

directory_service cache_refresh

Command Example
directory_service cache_refresh
[0%] ...
[100%] ...

Get_State Command

The get_state command displays the current status of the directory service.

Using Get_State

Description

The get_state command returns the state of the Active Directory and LDAP directory services. The command does not require entering properties or arguments. Enter the command, then press Enter. The command returns a table with the state of both the Active Directory and LDAP services as one of the five possible states in the table below.

Possible states:

StateDescription
DISABLEDIndicates directory service is disabled.
FAULTEDIndicates directory service is enabled, but not HEALTHY. Review logs and generated alert messages to debug the issue causing the faulted service state.
LEAVINGIndicates the directory service is in the process of stopping.
JOININGIndicates the directory service is in the process of starting.
HEALTHYIndicates the directory service is enabled, and the last status check passed.

Usage

From the CLI prompt, enter:

directory_service get_state

Command Example
directory_service get_state
+-----------------+----------+
| activedirectory | DISABLED |
|            ldap | DISABLED |
+-----------------+----------+

Directory_Service Namespaces

The following articles provide information on directory_service child namespaces:

  • Activedirectory: Provides information about the directory_service activedirectory namespace in the TrueNAS CLI. Includes command syntax and common commands.

    • Idmap: Provides information about the directory_service idmap namespace in the TrueNAS CLI. Includes command syntax and common commands.

      • Kerberos: Provides information about the directory_service kerberos namespace in the TrueNAS CLI. Includes command syntax and common commands.

        • LDAP: Provides information about the directory_service ldap namespace in the TrueNAS CLI. Includes command syntax and common commands.