Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Admin9705 committed Sep 17, 2024
1 parent 6e13b27 commit f7c442a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion mods/scripts/menu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f7c442a

Please sign in to comment.