From 60bac7bb41e90ef6e586eb24acc7bcec7ca88dae Mon Sep 17 00:00:00 2001 From: bilosikia Date: Tue, 12 Nov 2024 18:07:44 +0800 Subject: [PATCH] fix: docker file Root role, sudoer.d/ file name can not . --- docker/Dockerfile.ilogtail-build-linux | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docker/Dockerfile.ilogtail-build-linux b/docker/Dockerfile.ilogtail-build-linux index e8b12c5a88..2b842c8855 100644 --- a/docker/Dockerfile.ilogtail-build-linux +++ b/docker/Dockerfile.ilogtail-build-linux @@ -35,8 +35,10 @@ RUN if getent passwd $USERNAME; then userdel -f $USERNAME; fi && \ if getent group $GROUPNAME; then groupdel $GROUPNAME; fi && \ groupadd --gid $GROUP_GID $USERNAME && \ useradd --uid $USER_UID --gid $GROUP_GID -m $USERNAME && \ - echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME && \ - chmod 0440 /etc/sudoers.d/$USERNAME && \ + # the filename should not have the . or ~ symbol in its name + USER_SUDOER_FILE=$(echo $USERNAME | sed 's/\./-/g'); \ + echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USER_SUDOER_FILE && \ + chmod 0440 /etc/sudoers.d/$USER_SUDOER_FILE && \ chown -R $USERNAME:$GROUPNAME $(eval echo ~$USERNAME) && \ chmod 755 $(eval echo ~$USERNAME)