Solved How to set environment variables inside a "jexec" call?

I would like to call a command inside a jail using jexec(8) while setting environment variables for that particular call.

In a shell inside the jail I would call: KEYCLOAK_ADMIN=admin KEYCLOAK_ADMIN_PASSWORD=admin ./kc.sh show-config

How can I trigger this call outside of the jail? I tried passing the variables before the executable name (both in a single string parameter to jexec and as multiple parameters) but neither worked:
Bash:
    jexec "$JID" \
        KEYCLOAK_ADMIN=admin \
        KEYCLOAK_ADMIN_PASSWORD=admin \
        /usr/local/share/java/keycloak/bin/kc.sh show-config
# jexec: execvp: KEYCLOAK_ADMIN=admin: No such file or directory

    jexec "$JID" \
        "KEYCLOAK_ADMIN=admin  KEYCLOAK_ADMIN_PASSWORD=admin  /usr/local/share/java/keycloak/bin/kc.sh show-config"

# jexec: execvp: KEYCLOAK_ADMIN=admin  KEYCLOAK_ADMIN_PASSWORD=admin  /usr/local/share/java/keycloak/bin/kc.sh show-config: No such file or directory

I am not quite sure if I set the variables before "jexec" would they be passed to the shell inside the jail? I would find that weird.
 
Back
Top