workspaces-issues
workspaces-issues copied to clipboard
[Feature Request] - Pass KASM user name to docker
Need to be able to pass KASM username to docker. Example: instead of kasm-user, use the name of the current user admin@localhost
There is a group setting named expose_user_environment_vars , When set , KASM_USER and KASM_USER_ID will be exposed as environment variables in the container sessions.
https://kasmweb.com/docs/latest/guide/groups/group_settings.html
Whoami returns kasm-user instead of returning the KASM username. That's the kind of opportunity I'm talking about.
I would look into scripting the modifications to prep the environment per your requirements.
One easy way to do that is to leverage the File Mapping feature to Run a Script As Root when the container session starts.
For Example, this short example script modifies /etc/passwd assuming you've enabled expose_user_environment_vars to ensure the KASM_USER environment variable is present . I'm not totally sure of the implications and stability of this so use at your own risk, but its an example you can start from. For example I don't thing the @ is posix compliant so you may want to parse that
#!/usr/bin/env bash
set -ex
sed -i "s/kasm-user/$KASM_USER/g" /etc/passwd