From f7c442aba3c13649f8cce62ce498b6db5dd522c4 Mon Sep 17 00:00:00 2001 From: Admin9705 <9705@duck.com> Date: Tue, 17 Sep 2024 05:24:54 -0400 Subject: [PATCH] update --- mods/scripts/menu.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mods/scripts/menu.sh b/mods/scripts/menu.sh index 540c5dc08..f290839ec 100644 --- a/mods/scripts/menu.sh +++ b/mods/scripts/menu.sh @@ -4,9 +4,13 @@ RED="\033[0;31m" NC="\033[0m" # No color +# Get the username of the user with UID 1000 +REQUIRED_USER=$(getent passwd 1000 | cut -d: -f1) + # Enhanced security check: Block root user and only allow user with UID 1000 and GID 1000 if [[ $EUID -eq 0 ]] || [[ $(id -u) -ne 1000 ]] || [[ $(id -g) -ne 1000 ]]; then - echo -e "${RED}WARNING: This script can only be run by the user with UID 1000 and GID 1000, and cannot be run as root.${NC}" + echo -e "${RED}WARNING: This script can only be run by the user '$REQUIRED_USER' (UID 1000 and GID 1000).${NC}" + echo -e "${RED}It cannot be run as root or any other user.${NC}" read -p "Press [ENTER] to acknowledge" bash /pg/installer/menu_exit.sh exit 1