mirror of
https://github.com/hotyue/IP-Sentinel.git
synced 2026-06-08 10:49:41 +08:00
fix(core): Mandate root privileges for all setup scripts
The old setup scripts assume root privileges. We are fixing this by explicitly requiring an `$EUID` root check before execution so that no borked, non-root installations happen.
This commit is contained in:
@@ -5,6 +5,15 @@
|
||||
# 核心功能: 终止调度进程、清理看门狗定时任务、抹除数据库与配置
|
||||
# ==========================================================
|
||||
|
||||
# ==========================================================
|
||||
# 🛑 核心权限防线: 检查是否以 root 权限运行
|
||||
# ==========================================================
|
||||
if [ "$EUID" -ne 0 ]; then
|
||||
echo -e "\033[31m❌ 权限被拒绝: 卸载 IP-Sentinel 需要最高系统权限。\033[0m"
|
||||
echo -e "💡 请使用 \033[36msudo bash $0\033[0m 或切换到 root 用户 (su root) 后重新执行指令。"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
MASTER_DIR="/opt/ip_sentinel_master"
|
||||
CONF_FILE="${MASTER_DIR}/master.conf"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user