<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div><span style="color: black; font-size: 14pt; font-family: Calibri, Helvetica, sans-serif; background-color: white;" data-ogsc="black" data-ogsb="white">Hi All,</span></div>
<div style="color: black; font-size: 14pt; font-family: Calibri, Helvetica, sans-serif; background-color: white;" data-ogsc="black" data-ogsb="white">
<br>
</div>
<div style="color: black; font-size: 14pt; font-family: Calibri, Helvetica, sans-serif; background-color: white;" data-ogsc="black" data-ogsb="white">
I have hosted a nginx server instance and the temp directories are created under /etc/nginx/</div>
<div style="color: black; font-size: 14pt; font-family: Calibri, Helvetica, sans-serif; background-color: white;" data-ogsc="black" data-ogsb="white">
<br>
</div>
<div style="color: black; font-size: 14pt; font-family: Calibri, Helvetica, sans-serif; background-color: white;" data-ogsc="black" data-ogsb="white">
$ ls -ld /etc/nginx/*_temp
<div>drwx------ 2 nobody root 4096 Mar 16 15:21 /etc/nginx/client_body_temp</div>
<div>drwx------ 2 nobody root 4096 Mar 16 15:21 /etc/nginx/fastcgi_temp</div>
<div>drwx------ 2 nobody root 4096 Mar 16 15:21 /etc/nginx/proxy_temp</div>
<div>drwx------ 2 nobody root 4096 Mar 16 15:21 /etc/nginx/scgi_temp</div>
drwx------ 2 nobody root 4096 Mar 16 15:21 /etc/nginx/uwsgi_temp</div>
<div style="color: black; font-size: 14pt; font-family: Calibri, Helvetica, sans-serif; background-color: white;" data-ogsc="black" data-ogsb="white">
<br>
</div>
<div style="color: black; font-size: 14pt; font-family: Calibri, Helvetica, sans-serif; background-color: white;" data-ogsc="black" data-ogsb="white">
And I updated to a newer version of nginx which runs in "nginx" user context and after that these directory ownership is getting changed to nginx:root but the issue is, it happens only on these top directories and not directories within these temp directories.</div>
<div style="color: black; font-size: 14pt; font-family: Calibri, Helvetica, sans-serif; background-color: white;" data-ogsc="black" data-ogsb="white">
<br>
</div>
<div style="color: black; font-size: 14pt; font-family: Calibri, Helvetica, sans-serif; background-color: white;" data-ogsc="black" data-ogsb="white">
I did strace on the same to confirm my theory.</div>
<div style="color: black; font-size: 14pt; font-family: Calibri, Helvetica, sans-serif; background-color: white;" data-ogsc="black" data-ogsb="white">
<br>
</div>
<div style="color: black; font-size: 14pt; font-family: Calibri, Helvetica, sans-serif; background-color: white;" data-ogsc="black" data-ogsb="white">
mkdir("/etc/nginx/client_body_temp", 0700) = -1 EEXIST (File exists)
<div>stat("/etc/nginx/client_body_temp", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0</div>
<div>chown("/etc/nginx/client_body_temp", 997, -1) = 0</div>
<div>mkdir("/etc/nginx/proxy_temp", 0700)    = -1 EEXIST (File exists)</div>
<div>stat("/etc/nginx/proxy_temp", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0</div>
<div>chown("/etc/nginx/proxy_temp", 997, -1) = 0</div>
<div>mkdir("/etc/nginx/fastcgi_temp", 0700)  = -1 EEXIST (File exists)</div>
<div>stat("/etc/nginx/fastcgi_temp", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0</div>
<div>chown("/etc/nginx/fastcgi_temp", 997, -1) = 0</div>
<div>mkdir("/etc/nginx/uwsgi_temp", 0700)    = -1 EEXIST (File exists)</div>
<div>stat("/etc/nginx/uwsgi_temp", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0</div>
<div>chown("/etc/nginx/uwsgi_temp", 997, -1) = 0</div>
<div>mkdir("/etc/nginx/scgi_temp", 0700)     = -1 EEXIST (File exists)</div>
stat("/etc/nginx/scgi_temp", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0 </div>
<div>
<div style="color: black; font-size: 14pt; font-family: Calibri, Helvetica, sans-serif;" data-ogsc="black">
<br>
</div>
<div style="color: black; font-size: 14pt; font-family: Calibri, Helvetica, sans-serif;" data-ogsc="black">
Now the issue is, why chown happens only on top directory and not recursively on all files and directories inside them? Is this a bug or is it fixed in latest version of nginx?</div>
<div style="color: black; font-size: 14pt; font-family: Calibri, Helvetica, sans-serif;" data-ogsc="black">
<br>
</div>
<div style="color: black; font-size: 14pt; font-family: Calibri, Helvetica, sans-serif;" data-ogsc="black" class="elementToProof">
I'm currently using nginx-1.22.0. Any help would be appreciated. Thanks.<br>
</div>
</div>
<div class="elementToProof">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 14pt; color: rgb(0, 0, 0);">
<br>
</div>
<div id="Signature">
<div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
--</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Shedi<br>
</div>
</div>
</div>
</div>
</body>
</html>