From 1d7ca8bb4d628941efc8d39453c77a37692c380f Mon Sep 17 00:00:00 2001 From: lynxnot Date: Thu, 10 Mar 2022 22:29:21 +0100 Subject: [PATCH] Fix grep match of very short user or group names. (#197) --- distrobox-init | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/distrobox-init b/distrobox-init index c14cb7d1..f91e465c 100755 --- a/distrobox-init +++ b/distrobox-init @@ -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 \