Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

phpsessionclean fails on removing session files #77

Open
0xphk opened this issue May 28, 2020 · 1 comment
Open

phpsessionclean fails on removing session files #77

0xphk opened this issue May 28, 2020 · 1 comment

Comments

@0xphk
Copy link

0xphk commented May 28, 2020

Hi, unsure if this is a problem with the installation, but on Ubuntu 18.04 and Debian 10 the systemd-timer controlled phpsessionclean.service fails with similar errors on both systems, syslog:

sessionclean[24005]: find: cannot delete '/usr/local/tmp/sessions/sess_a5a9uj18v2qgsavdk2oq1carn7': Read-only file system

I can not find any clue, the permissions of the session files are 600 www-data:www-data which should be ok, but the session folder itself is 777 www-data:root with tempfs sticky bit.

I thought the 'root' group ownership of the sessions directory could be the problem but chown www-data:www-data does not fix this. I guess phpsessionclean is also run under www-data context.

Any help on this is appreciated, thank you

@0xphk
Copy link
Author

0xphk commented May 29, 2020

Looks like this is a systemd related error, probably some user context issue.

As manually running session-clean works, the problem can be fixed by switching back to cron:
systemctl disable --now phpsessionclean.timer

then modify /etc/cron.d/php and remove the systemd test condition from
09,39 * * * * root [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean; fi
to
09,39 * * * * root [ -x /usr/lib/php/sessionclean ] && /usr/lib/php/sessionclean

Now this uses cron again to run this in root context, so cleaning up old sessions works again.
Maybe this helps another ppl.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant