Use 'id -u' to check for root
Root user is not always named root but is always uid 0
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user