Restore everything after every reboot and lock out

Hello,

I would like to use Zorin OS Education in my school. But I have a couple of questions about how to make certain configurations.

I have seen in Windows a program that allows you to reset the user account every time the computer is restarted. The program in Windows is called "Deep Freeze". It would be nice if there was an option that allows this for the education part.

On the other hand and related to the above, would it be possible to block the change of settings, wallpaper (zorin appearance)?

I am not aware of specific software you can install to achieve this, but you can achieve the effect using a simple script. This means that wallpaper and theme will also set back to default on login.
It can also clear out anything saved in folders like ~/Downloads and ~/Pictures

You can setup a non-user access account where you configure your default Home Directory as you want it: Wallpapers, theme, panel position, etc. Then copy that to the skeleton directory replace the directions of path/to/you... with the actual path to your profile:

sudo cp -r /path/to/your/default/profile/* /etc/skel/

Create a new script in your accounts home directory (you can name it whatever you want; I will use reset_user.sh
Paste into it:

#!/bin/bash

rsync -a /etc/skel/ /home/$USER/

Give it executable permissions (use your path to your user account directory that has the script):

sudo chmod +x /home/$USER/reset_user.sh

Create a systemd service file to handle the script:

sudo touch /etc/systemd/system/reset_user.service

Open it in text editor:

sudo nano /etc/systemd/system/reset_user.service

Change the /home/$USER/reset_user.sh to the actual path to your reset script

[Unit]
Description=Reset User Profile on Logout

[Service]
Type=oneshot
ExecStart=/bin/true
ExecStop=/home/$USER/reset_user.sh

[Install]
WantedBy=default.target

Enable the service:

sudo systemctl enable reset_user_profile.service

Thank you very much for your reply.

Do I have to do all these steps in the account I want to block or from the PC administrator account?

The steps listed are done in the skel account, yes. Although it looks like a lot, it's mostly just copy and pasting.

You would set up the initial non-user account with all the configurations you wish to set as default state.
Then copy and place the script, paths, and set permissions.

I'm not doing something right, because it won't restore. The account name is "alumno", the file restore_user.sh is saved in /home/alumno/restore_user.sh

Would the commands look like this?

Copy that to the skeleton directory

sudo cp -r /home/alumno/* /etc/skel/

Create a new script reset_user.sh

#!/bin/bash

rsync -a /etc/skel/ /home/alumno/

Give it executable permissions

sudo chmod +x /home/alumno/reset_user.sh

Create a systemd service file to handle the script:

sudo touch /etc/systemd/system/reset_user.service

Open it in text editor:

sudo nano /etc/systemd/system/reset_user.service

Paste it

[Unit]
Description=Reset User Profile on Logout

[Service]
Type=oneshot
ExecStart=/bin/true
ExecStop=/home/alumno/reset_user.sh

[Install]
WantedBy=default.target

Enable the service:

sudo systemctl enable reset_user.service

Some are commands and some are file contents - your post above does not differentiate between the two so is a bit confusing.

Yes, as posted above, that should enable the reset_user_profile.service

Sorry, I have corrected it to make it easier to understand. Should it be like this?

Yes, everything looks correct.

You said it is not working - and have just verified each step. So, it may be that I am missing something or the way the system looks at the skel for managing user accounts is different.
Let me look into this and try to find a better method.

Attached are some problems that happen to me after doing the steps and rebooting,


It seems as if I don't have editing permissions.