Commit 9b9c3c7d authored by Peter Parente's avatar Peter Parente

Fix bug where container user is "nayvoj"

whoami &> /dev/null || STATUS=$? && true
causes STATUS to be set to an empty string
when the container starts with option --add-group="root"
resulting in both nayvoj and jovyan having uid=1000
and gid=100. The first match in /etc/password wins
and so the container user ends up being "nayvoj"
accidentally.

Avoid this by checking that whoami STATUS is neither blank nor 0
before adding a new /etc/passwd entry
parent 17aba604
......@@ -110,7 +110,7 @@ else
# container runs as. Check that the user has an entry in the passwd
# file and if not add an entry.
whoami &> /dev/null || STATUS=$? && true
if [[ "$STATUS" != "0" ]]; then
if [[ -n "$STATUS" && "$STATUS" != "0" ]]; then
if [[ -w /etc/passwd ]]; then
echo "Adding passwd file entry for $(id -u)"
cat /etc/passwd | sed -e "s/^jovyan:/nayvoj:/" > /tmp/passwd
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment