From 177088c2988aa610d0a5b81a3525e08e40d79b36 Mon Sep 17 00:00:00 2001 From: thelamer Date: Wed, 18 Sep 2019 09:12:00 -0700 Subject: [PATCH] decrease chance of collision if we are setting multiple group names --- root/etc/cont-init.d/50-gid-video | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/root/etc/cont-init.d/50-gid-video b/root/etc/cont-init.d/50-gid-video index 74e8050..c3d7f67 100755 --- a/root/etc/cont-init.d/50-gid-video +++ b/root/etc/cont-init.d/50-gid-video @@ -21,7 +21,7 @@ do if [ ! "${VIDEO_GID}" == '0' ]; then VIDEO_NAME=$(getent group "${VIDEO_GID}" | awk -F: '{print $1}') if [ -z "${VIDEO_NAME}" ]; then - VIDEO_NAME="video$(head /dev/urandom | tr -dc 0-9 | head -c4)" + VIDEO_NAME="video$(head /dev/urandom | tr -dc 'a-zA-Z0-9' | head -c8)" groupadd "$VIDEO_NAME" groupmod -g "$VIDEO_GID" "$VIDEO_NAME" fi @@ -33,4 +33,4 @@ done if [ ! -z "${FILES}" ] && [ ! -f "/groupadd" ]; then usermod -a -G root abc -fi \ No newline at end of file +fi