Bash require run as root

Require a bash script to run with root permissions.

#!/bin/bash
 
if [[ "${EUID}" != 0 ]]; then
   echo "Script must be run as root. Try: sudo bash ${0}"
   exit 1
fi
This post is available on GitHub.
Posted .

Comments

Leave a Reply