mirror of
https://github.com/jupyter/docker-stacks.git
synced 2025-10-11 03:52:56 +00:00
Warn if NB_USER not jovyan and can't rename home
This commit is contained in:
@@ -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
|
||||
|
@@ -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):
|
||||
|
Reference in New Issue
Block a user