voxel wrote:I would consider deploying an overlay filesystem, then on boot do a chroot into that overlay for his graphical user session. This would have the effect of making his changes non-persistent.
good idea

I've never done that, can you tell me more on how to do that ?
Well, there is a fair amount to it. Begin by studying how to use the overlay filesystem. You can start here:
https://wiki.archlinux.org/title/Overlay_filesystemLikely you would want to overlay the entire / system for this overlay.
After you have set up an overlay filesystem, you will want to do a mount bind on the various pseudo directories (/dev, /sys, /proc) so that entries there would be available in the overlay.
An example mount bind command would be:
- Code: Select all
mount -o bind /dev /myroot/dev
where /myroot is the root of the overlay filesystem that you set up
After you have everything set up, then your session would issue the command:
- Code: Select all
chroot /myroot
Once you have done this, you can start the user's graphical desktop in that session, and it will come up using the overlay, and any consoles started in the desktop will also use the overlay. All of the user's changes will be non-persistent.
Note that you have to alter the machine's startup to do this. Offhand I don't know where the best place to make the change would be; someone else might chime in with a recommendation. The real issue here is that systemd is parallel in its operation, and you want to change only the user session, not the entire system. So likely you want to hook the user startup where the desktop is loaded. I am sure it will require modifying system scripts.
Having done this, you then will want to make some of the stuff he does persistent - notably the config files you are worried about. I would handle this using a script in either bash or python that runs outside the user context (in other words, you start it earlier in the bootup process, and it is not part of the user context that is in the chroot), and that script would compare the copy of the config file that is in the overlay (for instance, /myroot/home/blah/.local/thisconfig) to the one on the underlying file system (/home/blah/.local/thisconfig) and would update the underlying file to match the overlay file (except, of course, you wouldn't delete the underlying file if he deleted it). Any of his own stuff that was to be persistent could be handled with a separate partition that does not participate in the overlay system.
As you can see, setting this up would cause you to spend a lot of time. It would, though, completely solve your problem. Is it worth doing? Well, I don't know. Only you can answer that one.