普通用戶執行 reboot、shutdown 等系統指令時提示「權限不足」。透過賦予執行檔 SUID(Set User ID) 特殊權限,可讓普通用戶以檔案擁有者(root)身份執行該指令,從而繞過權限限制。
which reboot
# /sbin/reboot
chmod 4744 /sbin/reboot
# 或符號模式:chmod u+s /sbin/reboot
su - user1
reboot
# 成功重啟

chmod 4744 中首位 4 代表 SUID,執行時有效 UID 變為檔案擁有者(root)。-rwsr--r--(擁有者執行位變為 s)。/sbin/shutdown、/sbin/halt、/sbin/poweroff 設定。find / -perm -4000 -type f 2>/dev/null。sudo 配置 /etc/sudoers(如 user1 ALL=(ALL) NOPASSWD: /sbin/reboot),可控性更高且有稽核軌跡。