pmbootstrap: Disallow running as root (#1120)
This commit is contained in:
parent
1992f37036
commit
4715c0f1bf
|
@ -37,8 +37,10 @@ def main():
|
||||||
|
|
||||||
# Wrap everything to display nice error messages
|
# Wrap everything to display nice error messages
|
||||||
try:
|
try:
|
||||||
# Sanity check
|
# Sanity checks
|
||||||
other.check_grsec(args)
|
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
|
# Initialize or require config
|
||||||
if args.action == "init":
|
if args.action == "init":
|
||||||
|
|
|
@ -171,6 +171,10 @@ def arguments():
|
||||||
" cause normal 'are you sure?' prompts to be"
|
" cause normal 'are you sure?' prompts to be"
|
||||||
" disabled!",
|
" disabled!",
|
||||||
action="store_true")
|
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
|
# Logging
|
||||||
parser.add_argument("-l", "--log", dest="log", default=None,
|
parser.add_argument("-l", "--log", dest="log", default=None,
|
||||||
|
|
Loading…
Reference in New Issue