diff --git a/base-notebook/start.sh b/base-notebook/start.sh index e79dfc11..5703ede3 100755 --- a/base-notebook/start.sh +++ b/base-notebook/start.sh @@ -199,6 +199,10 @@ else rm /tmp/passwd _log "Added new ${NB_USER} user ($(id -u):$(id -g)). Fixed UID!" + + if [[ "${NB_USER}" != "jovyan" ]]; then + _log "WARNING: user is ${NB_USER} but home is /home/jovyan. You must run as root to rename the home directory!" + fi else _log "WARNING: unable to fix missing /etc/passwd entry because we don't have write permission. Try setting gid=0 with \"--user=$(id -u):0\"." fi diff --git a/base-notebook/test/test_container_options.py b/base-notebook/test/test_container_options.py index 7fed8559..2f290548 100644 --- a/base-notebook/test/test_container_options.py +++ b/base-notebook/test/test_container_options.py @@ -286,8 +286,12 @@ def test_set_uid_and_nb_user(container): assert rv == 0 or rv["StatusCode"] == 0 logs = c.logs(stdout=True).decode("utf-8") assert "ERROR" not in logs - assert "WARNING" not in logs assert "uid=1010(kitten) gid=0(root)" in logs + warnings = [ + warning for warning in logs.split("\n") if warning.startswith("WARNING") + ] + assert len(warnings) == 1 + assert "user is kitten but home is /home/jovyan" in warnings[0] def test_container_not_delete_bind_mount(container, tmp_path):