diff --git a/bashup-backup-files.sh b/bashup-backup-files.sh index 09427ea..e08d6d1 100755 --- a/bashup-backup-files.sh +++ b/bashup-backup-files.sh @@ -19,6 +19,12 @@ if [[ -f /usr/local/etc/bashup.cnf ]]; then source /usr/local/etc/bashup.cnf fi +# require root +if [ "${EUID}" -ne 0 ]; then + echo "This script must be run as root" + exit 1 +fi + if [ ! -d $backup_storage_dir ]; then echo "ERROR: Backup storage dir ($backup_storage_dir) does not exist." exit 1 diff --git a/bashup-backup-mysql.sh b/bashup-backup-mysql.sh index 92ec937..065e8c6 100755 --- a/bashup-backup-mysql.sh +++ b/bashup-backup-mysql.sh @@ -21,6 +21,12 @@ if [[ -f /usr/local/etc/bashup.cnf ]]; then source /usr/local/etc/bashup.cnf fi +# require root +if [ "${EUID}" -ne 0 ]; then + echo "This script must be run as root" + exit 1 +fi + if [ ! -d $backup_storage_dir ]; then echo "ERROR: Backup storage dir ($backup_storage_dir) does not exist." exit 1 diff --git a/bashup-backup-pdns.sh b/bashup-backup-pdns.sh index e7642e1..2fe5842 100755 --- a/bashup-backup-pdns.sh +++ b/bashup-backup-pdns.sh @@ -17,6 +17,12 @@ if [[ -f /usr/local/etc/bashup.cnf ]]; then source /usr/local/etc/bashup.cnf fi +# require root +if [ "${EUID}" -ne 0 ]; then + echo "This script must be run as root" + exit 1 +fi + if [ ! -d $backup_storage_dir ]; then echo "ERROR: Backup storage dir ($backup_storage_dir) does not exist." exit 1 diff --git a/bashup-list-backups.sh b/bashup-list-backups.sh index 6a018f0..e8cea65 100755 --- a/bashup-list-backups.sh +++ b/bashup-list-backups.sh @@ -14,6 +14,12 @@ if [[ -f /usr/local/etc/bashup.cnf ]]; then source /usr/local/etc/bashup.cnf fi +# require root +if [ "${EUID}" -ne 0 ]; then + echo "This script must be run as root" + exit 1 +fi + help() { thisfilename=$(basename -- "$0") diff --git a/bashup-restore-files.sh b/bashup-restore-files.sh index 3c6f899..c16f672 100755 --- a/bashup-restore-files.sh +++ b/bashup-restore-files.sh @@ -14,6 +14,12 @@ if [[ -f /usr/local/etc/bashup.cnf ]]; then source /usr/local/etc/bashup.cnf fi +# require root +if [ "${EUID}" -ne 0 ]; then + echo "This script must be run as root" + exit 1 +fi + help() { thisfilename=$(basename -- "$0") diff --git a/bashup-restore-mysql.sh b/bashup-restore-mysql.sh index 56641ec..671f342 100755 --- a/bashup-restore-mysql.sh +++ b/bashup-restore-mysql.sh @@ -14,6 +14,12 @@ if [[ -f /usr/local/etc/bashup.cnf ]]; then source /usr/local/etc/bashup.cnf fi +# require root +if [ "${EUID}" -ne 0 ]; then + echo "This script must be run as root" + exit 1 +fi + help() { thisfilename=$(basename -- "$0") diff --git a/bashup-restore-pdns.sh b/bashup-restore-pdns.sh index ebf32ac..c775b2a 100755 --- a/bashup-restore-pdns.sh +++ b/bashup-restore-pdns.sh @@ -12,6 +12,12 @@ if [[ -f /usr/local/etc/bashup.cnf ]]; then source /usr/local/etc/bashup.cnf fi +# require root +if [ "${EUID}" -ne 0 ]; then + echo "This script must be run as root" + exit 1 +fi + help() { thisfilename=$(basename -- "$0")