diff --git a/app_containers/.local/bin/run_app_container b/app_containers/.local/bin/run_app_container index 011a4a8..c59a061 100755 --- a/app_containers/.local/bin/run_app_container +++ b/app_containers/.local/bin/run_app_container @@ -51,14 +51,18 @@ fi # Default user run_as=$UID -# We assume the user named `user` inside the container always has the same UID as -# the user with uid $run_as on the host; this is currently not yet configurable -homedir=/home/user if [ "$CONTAINER_RUN_AS_ROOT" = true ]; then run_as=0 - homedir=/root fi +homedir=/ +for line in $(sudo cat /var/lib/machines/$CONTAINER_NAME/etc/passwd); do + if [ "$(echo "$line" | cut -d: -f3)" == "$run_as" ]; then + homedir="$(echo "$line" | cut -d: -f6)" + break + fi +done + # Userns-related config # Default to identity mapping, which does not provide uid isolation but does for capabilities private_users=identity