After hours of searching and reading, I found the culprit. It's a setting for
systemd. The/etc/systemd/logind.confcontains default configuration options, with each of them commented out. TheRemoveIPCoption is set toyesby default. That option tellssystemdto clean up interprocess communication (IPC) for "user accounts" who aren't logged in. This does not affect "system accounts"In my case, the files and directories were being created for a user account, not a system account.
There are two possible solutions:
- Create the files with/for a system user -- a user created with the system option (
adduser -roradduser --system)- Edit
/etc/systemd/logind.conf, uncomment the lineRemoveIPC=yes, change it toRemoveIPC=no, save, and reboot the systemIn my case, I went with option #2 because the user was already created.
References: