From 6f407d2e4050dcf3fa00b81a95f2895744be28e8 Mon Sep 17 00:00:00 2001 From: Richard Weickelt Date: Fri, 30 Aug 2019 22:27:49 +0200 Subject: Allow overlapping uid/gid in container MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Makes it possible to start the container on a Linux host where the uid/gid of the current user is similar to an existing uid/gid in the container that is not the "devel" user. For instance, if the host gid is 100, then groupmod in the entrypoint script refuses to change the "devel" user to gid 100 because that gid is already taken by the "apt" group in the container. Change-Id: Ifc4980b118b9b94bf744aa1108225d3c727eb644 Reviewed-by: Jörg Bornemann --- docker/bionic/entrypoint.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'docker') diff --git a/docker/bionic/entrypoint.sh b/docker/bionic/entrypoint.sh index 9d7b7c10f..40bc5acb9 100755 --- a/docker/bionic/entrypoint.sh +++ b/docker/bionic/entrypoint.sh @@ -75,13 +75,13 @@ export HOME=/home/${USER_NAME} # if [ "${USER_UID}" != "0" ]; then if [ "$(id -u ${USER_NAME})" != "${USER_UID}" ]; then - usermod -u ${USER_UID} ${USER_NAME} + usermod -o -u ${USER_UID} ${USER_NAME} # After changing the user's uid, all files in user's home directory # automatically get the new uid. fi current_gid=$(id -g ${USER_NAME}) if [ "$(id -g ${USER_NAME})" != "${USER_GID}" ]; then - groupmod -g ${USER_GID} ${USER_GROUP} + groupmod -o -g ${USER_GID} ${USER_GROUP} # Set the new gid on all files in the home directory that still have the # old gid. find /home/${USER_NAME} -gid "${current_gid}" ! -type l -exec chgrp ${USER_GID} {} \; -- cgit v1.2.3