> For the complete documentation index, see [llms.txt](https://newdocs.keeper.io/en/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://newdocs.keeper.io/en/keeperpam/privileged-access-manager/getting-started/gateways/gateway-environment-configuration.md).

# Gateway Environment Configuration

## Overview

The gateway agent runs with default set of settings, which can be customized to add or remove internal features. This guide goes through the procedures for changing these settings, depending on the gateway installation medium.

There are two ways to apply settings / add features to the gateway:

* With environment variables (Docker, Windows, Linux)
* With CLI arguments (Windows, Linux)

Some features can only be set with environment variables, see [Gateway Environment Variables](/en/keeperpam/privileged-access-manager/getting-started/gateways/gateway-environment-variables.md) for a table of what is available with either approaches.

## Environment Variables

Environment Variables can be set to define gateway settings and features. For Docker installations, they are the only way to configure the gateway.

### Docker Installations

1. Update your `docker-compose.yml` file:

{% code overflow="wrap" %}

```bash
vi docker-compose.yml
```

{% endcode %}

2. Add / remove environment variables from the `environment` block of the gateway service:

{% code overflow="wrap" %}

```yaml
services:
  keeper-gateway:
    platform: linux/amd64
    image: keeper/gateway:latest
    shm_size: 2g
    restart: unless-stopped
    security_opt:
      - seccomp:docker-seccomp.json
      - apparmor:gateway-apparmor-profile
    environment:
      ACCEPT_EULA: Y
      GATEWAY_CONFIG: ey...
      KEEPER_GATEWAY_...: true    # ← New variable
```

{% endcode %}

3. Restart your Docker container:

{% code overflow="wrap" %}

```bash
docker compose up -d
```

{% endcode %}

### Linux Installations

The Linux-native gateway runs as a `systemd` service.

1. Update the service file:

{% code overflow="wrap" %}

```bash
vi /etc/systemd/system/keeper-gateway.service
```

{% endcode %}

2. Add / remove environment variables from the service configuration:

{% code overflow="wrap" %}

```bash
[Unit]
...

[Service]
...
ExecStart=/bin/bash -c "/usr/local/bin/gateway start --service --config-file /etc/keeper-gateway/gateway-config.json --log-to-stdout"
User=keeper-gw
Group=keeper-gw
Environment=RECORDING_PATH=/opt/keeper/gateway/recordings
Environment=TYPE_SCRIPT_RECORDING_PATH=/opt/keeper/gateway/recordings
Environment=GUACD_RECORDING_PATH=/opt/keeper/gateway/recordings
Environment=GUACD_TYPE_SCRIPT_RECORDING_PATH=/opt/keeper/gateway/recordings
Environment=KEEPER_RBI_PROFILE_STORAGE_PATH=/opt/keeper/gateway/rbi-profiles
Environment=KEEPER_RDP_DRIVE_STORAGE_PATH=/opt/keeper/gateway/rdp-drives
Environment=KEEPER_GATEWAY_...=true    # ← New variable
...

[Install]
...
```

{% endcode %}

3. Reload the systemd daemon:

{% code overflow="wrap" %}

```bash
systemctl daemon-reload
```

{% endcode %}

4. Restart the Keeper gateway:

{% code overflow="wrap" %}

```bash
systemctl restart keeper-gateway.service
```

{% endcode %}

### Windows Installations

The Windows-native gateway runs as a Windows Service by default. Variables can be set at machine-scope to apply to services and persist across user sessions:

1. In PowerShell, define new Keeper gateway environment variables:

{% code overflow="wrap" %}

```powershell
[Environment]::SetEnvironmentVariable("KEEPER_GATEWAY_...", "true", "Machine")
```

{% endcode %}

2. Restart the Keeper gateway service:

<figure><img src="/files/Rk7m5KoS85eWixTOMe34" alt="restart windows gateway service"><figcaption></figcaption></figure>

## CLI Arguments

The gateway is a program that launches when the service / container starts, and it starts with some CLI arguments by default. Additional arguments can be set to change gateway settings or add features.

### Docker Installations

Since Docker containers are ephemeral, the CLI shouldn't be used to update the gateway configuration, as changes won't persist if the container is restarted. The CLI can be used to run ephemeral commands, however, such as checking the gateway version:

{% code overflow="wrap" %}

```bash
docker exec -it <gateway-process-id> /opt/keeper/gateway/keeper-gateway version
```

{% endcode %}

### Linux Installations

The Linux-native gateway runs as a `systemd` service, which executes the `gateway start` CLI when the service starts. You can add CLI arguments to the start command in the following way.

1. Update the service file:

{% code overflow="wrap" %}

```bash
vi /etc/systemd/system/keeper-gateway.service
```

{% endcode %}

2. Add / remove environment variables from the service configuration:

{% code overflow="wrap" %}

```bash
[Unit]
...

[Service]
...
ExecStart=/bin/bash -c "/usr/local/bin/gateway start --service --config-file /etc/keeper-gateway/gateway-config.json --log-to-stdout <CLI_ARGUMENT_HERE>"
...

[Install]
...
```

{% endcode %}

3. Reload the systemd daemon:

{% code overflow="wrap" %}

```bash
systemctl daemon-reload
```

{% endcode %}

4. Restart the Keeper gateway:

{% code overflow="wrap" %}

```bash
systemctl restart keeper-gateway.service
```

{% endcode %}

### Windows Installations

The Windows-native gateway runs as a Windows Service by default, which executes the `gateway start` CLI when the service starts. You can add CLI arguments to the start command in the following way.

1. Open the Keeper gateway service's Properties menu, and add arguments in the input field (the service must be stopped first):

<figure><img src="/files/nYPXvVS2F2bkk2k17jF4" alt=""><figcaption></figcaption></figure>

2. Make sure to start the service from that menu (do not press OK), or else the new arguments will not be accounted for.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://newdocs.keeper.io/en/keeperpam/privileged-access-manager/getting-started/gateways/gateway-environment-configuration.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
