From 92f99edb13c151b501dc58350dd717090bc2076e Mon Sep 17 00:00:00 2001 From: Dominik Danter Date: Mon, 1 Jul 2013 09:45:31 -0500 Subject: [PATCH] changed amirootcheck --- sshbackup | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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