/ Published in: Bash
If you have a script that must be run as the root user, put this at the top:
- #Test if user is root
- if [ "$(id -u 2>/dev/null)" != "0" ]; then
- echo "ERROR: $0 must be run as root" >&2
- exit 1
You need to login to post a comment.