Clearing history and cache from a script

I am installing LO on self-service Linux computers in a library.

To ensure privacy, I need to clear all history, cache, documents to restore etc at session end from the login script

What do I need to delete or restore ?

And to ensure the default settings are not changed between users
, what do I need to “freeze” with chattr ?

I think most of the stuff you are looking for is going to be in:

$HOME/.config/libreoffice/4/

There is a cache folder there but from my experience it doesn’t really get rid of everything. Maybe there is more stuff stored in /tmp/ or /opt/libreoffice6.1/

As for the settings, a lot is stored in:

$HOME/.config/libreoffice/4/registrymodifications.xcu

If you just want the default settings, I think you can just delete this file every time (easiest way in my opinion) or keep a template file for default settings you want.

I’m relatively new to LibreOffice so hopefully someone can give us more details or correct me if I’m wrong