Use 'id -u' to check for root

Root user is not always named root but is always uid 0
This commit is contained in:
Tim Sedlmeyer
2018-04-11 18:54:03 -04:00
parent 8bd5867fe9
commit 444307193a

View File

@@ -14,7 +14,7 @@ function CheckUser {
# Make sure the script is ran as root
if [[ ! $(whoami) == "root" ]]; then
if [[ ! "$(id -u)" == "0" ]]; then
echo "This script needs to be ran as root"
exit 0
fi