I have a setup exactly as per Craig’s amazing Installing Magento 2.4 from scratch video (I’ve installed 2.4.1, but everything else is the same)
By default the session files are stored by Ubuntu 20.04 in /var/lib/php/sessions/
They are automatically deleted after 24 minutes by gc_maxlifetime.
On Magento 1.9 they were in /var/www/var/session/ and I used a script in M1.9 to delete visits from search engines, leaving the genuine customer visits so that baskets for visitors didn’t expire so quickly.
I am wanting to apply this same process to Magento 2.4 so…
To change the path these files are stored in, you simple edit /app/env.php as per these instructions.
However, I have 2 questions which I am unsure about but are probably obvious to Craig and the contributing clever people on here!
QUESTION 1. What should the folder permission be for /var/www/var/session/ ?
Should it be 775 like the rest of the Magento folders?
or like the original /var/lib/php/sessions/ which is 733 with a t on it (drwx-wx-wt)
QUESTION 2. How can I get Magento to set the permission of a session files when it creates one to 660?
The reason for asking this is because they are set at 600 which means I cannot open the files or back them up when using rsync - I get permission denied.
The session files are set as 600 www-data:www-data
Whereas the user:group for the FTP is magento:www-data as per craig’s 2 user setup.
Thanks in advance for your replies.