aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Weickelt <richard@weickelt.de>2019-08-30 22:27:49 +0200
committerRichard Weickelt <richard@weickelt.de>2019-09-02 07:24:06 +0000
commit6f407d2e4050dcf3fa00b81a95f2895744be28e8 (patch)
treef1d0250e7d81a1b4b7d638dce09f4da940dd1ff3
parent277092aabc2158affd84a97792eaeecfbd371583 (diff)
Allow overlapping uid/gid in container
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 <joerg.bornemann@qt.io>
-rwxr-xr-xdocker/bionic/entrypoint.sh4
1 files changed, 2 insertions, 2 deletions
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} {} \;