Re: Security risk how to use find recommended in php.ini-*
| From: | Reindl Harald | Date: | Wed, 08 Feb 2012 23:43:18 +0000 |
| Subject: | Re: Security risk how to use find recommended in php.ini-* | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-57804@lists.php.net to get a copy of this message | ||
Am 09.02.2012 00:35, schrieb Ondřej Surý:
> Much better would be:
>
> find /path/to/sessions -cmin +24 -delete
> or at least
> find /path/to/sessions -cmin +24 -execdir rm "{}" \; (GNU find)
>
> The most error-prone way is something we cooked up in Debian:
>
> find /var/lib/php5/ -depth -mindepth 1 -maxdepth 1 -type f
> -ignore_readdir_race -cmin +24 ! -execdir fuser -s {} 2>/dev/null \;
> -delete
>
> which depends on fuser at least version 22.15 (which has removed
> fork() call which was able to swamp up whole system with zombies).
>
> The fuser call checks if the session file is still in use, because the
> script was deleting still active sessions opened 24+ mins ago.
the main question is why here "cmin" is used instead "mmin"?
find /var/www/sessiondata -type f -mmin +60 -exec rm -f {} \; 2> /dev/null > /dev/null
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc