From d5f1411ed17988f0b50d7c594d65597272517637 Mon Sep 17 00:00:00 2001 From: Nick Sweeting Date: Sun, 17 Dec 2023 16:57:40 -0800 Subject: [PATCH] exit with running as root error when PUID is 0 --- archivebox/config.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/archivebox/config.py b/archivebox/config.py index 785e6a60..79bc5811 100644 --- a/archivebox/config.py +++ b/archivebox/config.py @@ -1118,15 +1118,15 @@ if not CONFIG['CHECK_SSL_VALIDITY']: def check_system_config(config: ConfigDict=CONFIG) -> None: ### Check system environment - if config['USER'] == 'root': + if config['USER'] == 'root' or str(config['PUID']) == "0": stderr('[!] ArchiveBox should never be run as root!', color='red') stderr(' For more information, see the security overview documentation:') stderr(' https://github.com/ArchiveBox/ArchiveBox/wiki/Security-Overview#do-not-run-as-root') if config['IN_DOCKER']: - attempted_command = " ".join(sys.argv[:3]) + attempted_command = ' '.join(sys.argv[:3]) stderr('') - stderr(' {lightred}Hint{reset}: When using Docker, ArchiveBox commands should run with {green}docker run{reset} instead of {lightyellow}docker exec{reset}, e.g.:') + stderr(' {lightred}Hint{reset}: When using Docker, you must run commands with {green}docker run{reset} instead of {lightyellow}docker exec{reset}, e.g.:') stderr(f' docker compose run archivebox {attempted_command}') stderr(' or') stderr(f' docker run -it -v ... -p ... archivebox/archivebox {attempted_command}')