Fix grep match of very short user or group names. (#197)

This commit is contained in:
lynxnot
2022-03-10 22:29:21 +01:00
committed by GitHub
parent d98974b5a5
commit 1d7ca8bb4d
+2 -2
View File
@@ -510,11 +510,11 @@ if ! grep -q "${container_user_name} ALL = (root) NOPASSWD:ALL" /etc/sudoers.d/s
fi
# If not existing, ensure we have a group for our user.
if ! grep -q "${container_user_name}" /etc/group; then
if ! grep -q "^${container_user_name}:" /etc/group; then
groupadd --force --gid "${container_user_gid}" "${container_user_name}"
fi
# Let's add our user to the container. if the user already exists, enforce properties.
if ! grep -q "${container_user_name}" /etc/passwd; then
if ! grep -q "^${container_user_name}:" /etc/passwd; then
if ! useradd \
--home-dir "${container_user_home}" \
--no-create-home \