From 227120fd57c9fe3287a2feccd9eb4e30cc40909f Mon Sep 17 00:00:00 2001 From: Expo on server <expo@expo.survex.com> Date: Tue, 26 May 2020 00:47:01 +0100 Subject: [PATCH] Add check to avoid running databaseReset as root accidentally --- databaseReset.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/databaseReset.py b/databaseReset.py index 81a3ad5..bfed32a 100644 --- a/databaseReset.py +++ b/databaseReset.py @@ -6,6 +6,10 @@ import timeit import json import settings +if os.geteuid() == 0: + print("This script should be run as expo not root - quitting") + exit() + os.environ['PYTHONPATH'] = settings.PYTHON_PATH os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'settings')