Forums | Mahara Community

Support /
Logged out user can not be stored in usr_session


Andi Becker's profile picture
Posts: 68

11 August 2021, 2:32

After we tried to log in we receive the following message. In Error logs is nothing valuable and in the Google search we found only something about sessions and numbered folders which at some point did get created but as it looks like all folders 0 - v are available Not wxyz - perhaps that's the problem but we tried and it is still not working - As we try to understand why those errors happen and how to fix them any more ideas are very appreciated. Thanks. Andi

Logged out user can not be stored in usr_session


Kristina Hoeppner's profile picture
Posts: 4717

11 August 2021, 9:25

Hi Andi,

Can you please provide a bit more information when you encounter the error message?

Thank you

Kristina

Robert Lyon's profile picture
Posts: 749

11 August 2021, 10:45

Hi Andi,

Looking at https://www.php.net/manual/en/session.configuration.php#ini.session.sid-length

"session.sid_bits_per_character int session.sid_per_character allows you to specify the number of bits in encoded session ID character. The possible values are '4' (0-9, a-f), '5' (0-9, a-v), and '6' (0-9, a-z, A-Z, "-", ","). The default is 4. The more bits results in stronger session ID. 5 is recommended value for most environments."

Mahara is designed to run with session.sid_bits_per_character set to 4 or 5

Is your site's php.ini set to have a higher value?

Robert

 

Andi Becker's profile picture
Posts: 68

11 August 2021, 14:06

@Kristina.

the problem occured when we were moving the data storage folder to another location, 

home/user/maharadata
to
home/user/data/MaharaData
as we had
home/user/data/MoodleData
and
home/user/data/HumHubData already there

Meanwhile we changed checked in the Database and that storage folder and it looks actually fine as nothing there has changed, no owner and no permission change, only the location. 

@Robert

the server hasn't changed, nor the php.ini settings and the site was running before with no problem. We only get always unfortunately in problems with Mahara when we move Mahara or clone Mahara. In that case we moved the storage Folder Location and of course changed the path also in the config file.Screen Shot 2021-08-11 at 09.04.34.png

Robert Lyon's profile picture
Posts: 749

12 August 2021, 10:04

Hi Andi,

Just double checking two things:

1) the value for $cfg->dataroot in your config has the right directory path  (which I assume is correct otherwise there would be other errors)

2) that the parent directory home/user/data/  has the right permissions on it.

 

One thing you could try to see if makes a difference is go into the /home/user/data/ directory and run the following lines that should reset the permissions on all the subdirs / files for the session directories:

chown -R www-data:www-data MaharaData/
find /home/user/data/MaharaData/sessions/ -type d -exec chmod 700 {} \;
find /home/user/data/MaharaData/sessions/ -type f -exec chmod 600 {} \;

Cheers

Robert

 

 

Andi Becker's profile picture
Posts: 68

13 August 2021, 3:11

Thanks Robert for your idea but it is not working.

the folders are all 0700 and there are three folder levels

1

2

3

4
- 1

- 2

- 3

- 4

- - ...

- - 4 that folder is empty so I can't check teh file permissions but assume that they are 0600

- - ...

...

5

 

What did I actually do?

I cloned a site

in
domain1/public_html/mahara/(all mahara files)

domain1/data/MaharaData

I than copied those two folders at exactly the same position to other domains. ( I copied it multiple time for different domains)

domain2/public_html/mahara/(all mahara files)

domain2/data/MaharaData

I than delete the cache folder in the MaharaData folder woo and smarty

and of course changed the credentials in the mahara/config file and also adjusted the path

next I went to the DB and changed the URL in the databasetable from domain1 to domain2 the same the noreply@domain1 to noreply@domain2

Actually pretty simple stuff which we do usually with many other apps the same way but with Mahara it always causes problems when we clone or do as described.

The permissions are always the same in all sites
The owner is (as it is Virtualmin) always Domain1owner:Domain1owner and we change it accordingly to Domin2owner:Domain2owner - The original sie works perfect with all those settings but the clones "protest" with that error.

 

Andi Becker's profile picture
Posts: 68

13 August 2021, 22:46

What I also realized is that you can't reset the password in all cloned sites even it send correctly an email and that blue banner warning also does not show up.

All works fine on the mother installation - when you reset the password the blue warning shows up and you get the email send and now can click on a link which works and after filling in the two fields you can rely again with that password.

But that is not at all working I the cloned sites we're we have all those problems

Screen Shot 2021-08-13 at 17.28.28.png

We tried by the way also to load a clone again to the mother site replacing it and all works fine.

Andi Becker's profile picture
Posts: 68

15 August 2021, 4:37

This problem is becoming pretty annoying honestly.
Yesterday we moved some Mahara sites for testing to subdomains and all worked fine so we thought it might be a problem caused by the location the site is running from and probably a subfolder is not what Mahara likes so much. $ sites allure able to log in with no problem but today morning again one site completely blocked because of that usr_session problem. grrrr.

The point is you can't let people on such a site which proves to be to unstable so we are really stuck as we also won't put all the other sites life until that problem is solved.

There must be an easy way to clone and to multiply a site without any says or actually hours of waste. Cloning is pretty often needed when problems occur and that simply has to be easy and working, but it isn't. We can't figure out why that happens again and again when Mahara sites get moved or when the owner changes, which is pretty normal when you clone or multiply a site. A great system with a huge hick up I would say. So sad. 

Unfortunately we could not find any proper description where the steps on how to move/clone a Mahara site is explained.

how to deal with points like:

  1. the domain name changes
  2. the user who runs the server changes
  3. the maharadata folder gets moved to another location or renamed (for whatever reason)
  4. when it is installed in root of a subdomain
  5. when it is installed in a subfolder of another site.

We are using Ubuntu 20.04.1 LTS - with MariaDB 10.5.5 - PHP FPM 7.4.22 - Apache2.4.41 - Virtualmin/Webmin which runs by default with SymlinksIfOwnerMatches (not with insecure FollowSymlinks) and all servers run on their respective virtual server owners.

 

Kristina Hoeppner's profile picture
Posts: 4717

16 August 2021, 14:20

Hi Andi,

I'm sorry to hear about the issues you are encountering. We work regularly with cloned sites both on servers and also locally, so I don't know why this is not working for you as you normally don't have to make a lot of changes except for the changes in the config.php file where you point to the correct wwwroot (easier than using the value in the database), DB name, maharadata folder etc. That has been working well for many years.

Typically, www-data is the account on the web server under which things run rather than a specific person to ensure that others could access the folders if needed.

Maybe you can find some helpful information in the section on copying a local install to another as that contains basics that would most likely also need to be done on a server.

Things that we usually need to change when migrating the site to a new domain with the DB and site files staying in place:

  • Change the SSL certificate
  • Update keys for SAML, MNet (if still in use)
  • Make sure the wwwroot is correct

Cheers

Kristina

Andi Becker's profile picture
Posts: 68

17 August 2021, 21:16

That is actually exactly what we are doing - only the user/group stays as the one who runs the virtual server. 
We do that with all other sites too and no problems. Only Mahara sometimes works and than suddenly denies access.
Some sites we cloned like that work, some for short time and than deny access and others don't deny - I can't find a logic. But it seems to be a session problem, probably with the DB - we use MariaDB. this usr_session is in the database

 

11 results