Centos – /var/run/screen permissions changing to 775 without restart

centoscentos7chmodgnu-screenpermissions

Good <Insert Part of Day>,

I am currently having an issue with several of my boxes running CentOS 7.3.1611 wherein the permissions for /var/run/screen are being changed to 775, resulting in the error "Directory '/var/run/screen' must have mode 755". The boxes have been running for several weeks without a restart or package upgrades, the issue was discovered earlier today. There is one sudoer on the boxes, with no signs of intrusion.

Changing the permissions back is simple, but we still have no idea what keeps happening. Does anyone have any ideas we can look into?

Best Answer

I don't have a CentOS box handy but assuming it uses systemd it may be similar to Ubuntu where there is /usr/lib/tmpfiles.d/screen-cleanup.conf with:

d /var/run/screen 0775 root utmp

and /lib/systemd/system/systemd-tmpfiles-clean.timer with

[Timer]
OnUnitActiveSec=1d

So it will reset to 0775 daily. You can disable it by linking /etc/tmpfiles.d/screen-cleanup.conf to /dev/null

However as @kasperd said, you probably have some other misconfiguration.

Note: I have not tested this.