Skip to content


Enforcing Executing User on Bash Scripts

Sometimes I want to make sure that a script is *not* being run by the root user:

#!/bin/bash
if [[ $EUID -eq 0 ]]; then
  echo "Don't run as root!"
  exit 1
fi

Posted in Bash, Tips and Tricks.

Tagged with , , .


0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.



Some HTML is OK

or, reply to this post via trackback.