From 1571f10fad0ee8a69ac34e5686ee6bc9837de19c Mon Sep 17 00:00:00 2001 From: Gustavo Kennedy Renkel Date: Thu, 18 Jun 2026 18:39:42 -0300 Subject: [PATCH] Core: skipped path ownership changes during configuration testing. When the "user" directive is in effect and "nginx -t" or "nginx -T" is run by a user different from the one nginx normally runs as (notably as root, while workers run as an unprivileged packager-provided user such as "nginx" or "www-data"), ngx_create_paths() changed the ownership of the temporary directories (proxy_temp, client_body_temp, etc.) to the configured user. This left the directories owned by the wrong user for the instance that is actually running, resulting in a permission mismatch. Configuration testing is not expected to modify filesystem state, so ownership and permission changes are now skipped when ngx_test_config is set. Directories are still created as before. --- src/core/ngx_file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/ngx_file.c b/src/core/ngx_file.c index 63ada8557..33cf26318 100644 --- a/src/core/ngx_file.c +++ b/src/core/ngx_file.c @@ -614,7 +614,7 @@ ngx_create_paths(ngx_cycle_t *cycle, ngx_uid_t user) } } - if (user == (ngx_uid_t) NGX_CONF_UNSET_UINT) { + if (user == (ngx_uid_t) NGX_CONF_UNSET_UINT || ngx_test_config) { continue; }