# HG changeset patch # User Kim Alvefur # Date 1711312320 -3600 # Node ID 2dbc169aae6a04f3e028b6d5c155f2e1bb8d2b69 # Parent 3ce550ce44ce541b31fad6bca3e0526fe97bd5e2 util.startup: Abort before initialization of logging when started as root Prevents creation of log files owned by the root user which could be inaccessible once started correctly. diff -r 3ce550ce44ce -r 2dbc169aae6a util/startup.lua --- a/util/startup.lua Sun Mar 24 21:31:47 2024 +0100 +++ b/util/startup.lua Sun Mar 24 21:32:00 2024 +0100 @@ -692,8 +692,8 @@ if not pposix then return end -- Don't even think about it! if pposix.getuid() == 0 and not config.get("*", "run_as_root") then - log("error", "Danger, Will Robinson! Prosody doesn't need to be run as root, so don't do it!"); - log("error", "For more information on running Prosody as root, see https://prosody.im/doc/root"); + print("Danger, Will Robinson! Prosody doesn't need to be run as root, so don't do it!"); + print("For more information on running Prosody as root, see https://prosody.im/doc/root"); os.exit(1); -- Refusing to run as root end end @@ -864,8 +864,8 @@ startup.parse_args(); startup.init_global_state(); startup.read_config(); + startup.check_user(); startup.init_logging(); - startup.check_user(); startup.init_gc(); startup.init_errors(); startup.sanity_check();