0

I need to install Ubuntu on a system and also need that that system automatically recovers to a default state previously configured. Can you recommend a software that can do that?

I can use a live Ubuntu drive but the issue with that is that I can't make custom modifications to the configuration and preserve them after restart.

So for example I need to create one snapshot with the basic configuration and no matter what changes are made during a session, after rebooting the PC it recovers automatically to that snapshot. Is it possible? What software can I use?

eera5607
  • 367
  • Is this a kiosk type set up? How about creating an unprivileged user our guest user who can't save any changes to the system? Another way may be to save an image of the system partition and restore from it when needed. Restore may take a long time depending on partition size, disk types etc. – user68186 Jan 27 '19 at 22:45
  • A more complicated setup would involve an overlayfs with a configured system at the bottom and a ramfs ontop. But that may not be worth the effort, depending on what exactly you want to achieve. – danzel Jan 28 '19 at 00:18
  • @user68186 thank you. Yes, now that you say it, I think the first option (unprivileged user) might accomplish what I want. In that case is it possible for the user to add files for the session and be gone after reboot? It is kind of kiosk setup. I know how to implement the second option with TimeShift and btrfs but in that case I can't go and recover the snapshot for every session manually that's why I was asking for software that can recover a specific snapshot every reboot. – eera5607 Jan 28 '19 at 00:33
  • @danzel thanks, I just want to pre-configure a system, create a sort of snapshot and after that every changes made on every subsequent session need to be gone after reboot or even if possible every change of session. Is that possible for a intermediate level user like me? – eera5607 Jan 28 '19 at 00:40
  • 1
    LightDM (which was used until and including 16.04) had a guest session. 16.04 will be supported until April 2021, so if possible, use 16.04 with guest session. There is a workaround for newer releases using GDM3 which you can find in this Q&A, but it's not as secure and more complicated to setup. – danzel Jan 28 '19 at 10:51

1 Answers1

1

Ubuntu 16.04 Guest Session

As others have pointed out the guest session available in Ubuntu 16.04 LTS may do what you need. The guest session has the following characteristics:

  • Does not have any password. Anyone can log into the guest session.
  • Guest cannot save any files in the computer (saving to attached USB drive is OK).
  • Guest cannot do anything that requires sudo such as install or uninstall any software.
  • Guest cannot view or access in any way the system folders and home folders of standard users.
  • Any changes the guest makes to the desktop, such as change wallpaper, add or remove shortcuts, etc. will be reverted back to original state when the guest logs out and a new guest logs in.

Warning: Ubuntu 16.10 and above have the guest account disabled by default because of a systemd security bug that allows the guest to get into the home directory of any other users. See Guest session stopped working on Ubuntu versions later than 16.04 for more details.

How to modify Ubuntu 16.04 Guest Session

As an administrator you may want to change the guest session look and feel. For example:

  • You may want to remove Firefox from the launcher and put the Chrome there. (You will have to install Chrome using the administrator account first).
  • You may want to stop the backup software pop up and tell the guest to back up things. (The guest can't use backup anyway.)

Follow these steps to make such changes:

Log on to the administrator account, the account you created when you installed Ubuntu and where you can use sudo and:

  1. and open a terminal by pressing Ctrl+Alt+T and create the directory /etc/guest-session/skel

    sudo mkdir -p /etc/guest-session/skel

    Do not close the terminal yet.

  2. While logged to the administrator account, start a guest session. You will need to switch between the guest and administrator account later.

  3. Make any changes to the guest session that you want using whatever tools/utilities you wish

  4. Wait for Backup setup to show up. Click on don’t show again. This will stop it from showing up every time a guest logs in.

Do not log out the guest session!

  1. Switch back to admin account.

  2. Using the open terminal, find the temporary guest home directory. It will look like guest-XXXXX, where XXXXX is a random bunch of numbers and letters. These change every time a new guest session is created.

    ls /tmp/guest*

  3. Copy the files in the temporary guest home directory to /etc/guest-session/skel using the command:

    sudo cp -rT /tmp/guest-XXXXX /etc/guest-session/skel

    This will save all the changes you have made to the current guest session.

  4. Log out of the guest session and login again to the guest session to verify the new guest session starts with all the changes you just made.

To make more changes, repeat steps 2-7 as necessary.

Source: http://ubuntuforums.org/showthread.php?t=2152804&p=12687863#post12687863

Hope this helps

user68186
  • 33,360