diff --git a/base-notebook/start.sh b/base-notebook/start.sh index 3cde6105..02e3f071 100755 --- a/base-notebook/start.sh +++ b/base-notebook/start.sh @@ -70,11 +70,12 @@ if [ $(id -u) == 0 ] ; then usermod -u $NB_UID $NB_USER fi - # Add NB_USER to NB_GID if it's not the default group + # Set NB_USER primary gid to NB_GID (after making the group). Set + # supplementary gids to NB_GID and 100. if [ "$NB_GID" != $(id -g $NB_USER) ] ; then echo "Add $NB_USER to group: $NB_GID" - groupadd -g $NB_GID -o $NB_USER - usermod -a -G $NB_GID $NB_USER + groupadd -g $NB_GID -o ${NB_GROUP:-${NB_USER}} + usermod -g $NB_GID -a -G $NB_GID,100 $NB_USER fi # Enable sudo if requested diff --git a/base-notebook/test/test_container_options.py b/base-notebook/test/test_container_options.py index 5ec04f61..451074c8 100644 --- a/base-notebook/test/test_container_options.py +++ b/base-notebook/test/test_container_options.py @@ -57,8 +57,8 @@ def test_gid_change(container): ) c.wait(timeout=10) logs = c.logs(stdout=True).decode('utf-8') - assert 'gid=100(users)' in logs - assert 'groups=100(users),110(jovyan)' in logs + assert 'gid=110(jovyan)' in logs + assert 'groups=110(jovyan),100(users)' in logs def test_sudo(container):