diff --git a/pmb/__init__.py b/pmb/__init__.py index c5e93746..30c8cbd7 100644 --- a/pmb/__init__.py +++ b/pmb/__init__.py @@ -37,8 +37,10 @@ def main(): # Wrap everything to display nice error messages try: - # Sanity check + # Sanity checks other.check_grsec(args) + if not args.as_root and os.geteuid() == 0: + raise RuntimeError("Do not run pmbootstrap as root!") # Initialize or require config if args.action == "init": diff --git a/pmb/parse/arguments.py b/pmb/parse/arguments.py index 26f45296..1e002e82 100644 --- a/pmb/parse/arguments.py +++ b/pmb/parse/arguments.py @@ -171,6 +171,10 @@ def arguments(): " cause normal 'are you sure?' prompts to be" " disabled!", action="store_true") + parser.add_argument("--as-root", help="Allow running as root (not" + " recommended, may screw up your work folders" + " directory permissions!)", dest="as_root", + action="store_true") # Logging parser.add_argument("-l", "--log", dest="log", default=None,