diff --git a/sshbackup b/sshbackup index 3abdb5d..7acdab7 100755 --- a/sshbackup +++ b/sshbackup @@ -69,8 +69,10 @@ preflight() { #amiroot? - if [ $(whoami) != "root" ]; then - echo "aborting mission. you must be root." + # Thhis is a safter way of testing this + # See: http://askubuntu.com/questions/30148/how-can-i-determine-whether-a-shellscript-runs-as-root-or-not/ + if ! [ $(id -u) = 0 ]; then + echo "aborting mission, you must be root." return 1 fi