How to preserve and freeze modification made during a LiveSession of LiveDisc and to prevent any further modification without remastering the LiveDisc
Custom LiveDisc
Your best choice is probably to create a new custom LiveDisc, but it is a lot of work to setup.
Workaround using a persistent live system
I will suggest a workaround here:
Setup
-
Use a persistent live drive by mkusb and set it up with the desired properties (tweaks, installed programs etc)
-
Make a tarball of the content in the partition for persistence and store it in some other partition or drive. There is already a tool for it in mkusb, made for backup purposes.
-
Then you can use the system with persistence
[Repeated] usage
-
At shutdown you should remove the content of the partition for persistence (if it is important to maintain security and privacy)
-
Boot into a live (live-only) session and extract the content from the tarball into the partition for persistence ...
-
and reboot, this time into the persistent live session with the desired properties.
How to make a persistent USB install read-only
It is possible to do what you want using a modified Guest User account
-
Install lightdm:
sudo apt-get install lightdm
The install process will ask to remove GDM.
- At popup select lightdm as display manager.
For a grub2 booters with persistent casper-rw partitions, such as mkusb:
Open casper-rw/upper/etc/lightdm/lightdm.conf and change allow-guest=true
. Now there will be a Guest account.
For Syslinux booters with persistent casper-rw files such as UNetbootin and Rufus: First mount the casper-rw file:
sudo mkdir /media/casper
sudo mount -o loop casper-rw /media/casper/
Then edit casper/upper/etc/lightdm/lightdm.conf and change allow-guest=true
A guest account will be added to boot options.
Modifying the Guest Account
You may use an existing User Account, or create a new User Account, to use as a Live basis for customizing the Guest Session.
Make a directory for guest session, if one does not already exist:
sudo mkdir /etc/guest-session
Create a symbolic link:
sudo ln -s /home/{NAME} /etc/guest-session/skel
Where {NAME} is the name of the User Account you wish to use as a basis.
Any changes made to the user account will appear in the guest account.
Any changes to the guest account will be deleted at end of the session.
User {NAME} can be hidden at login:
-
To hide the user open /var/lib/AccountsService/users/{NAME}
-
Edit line to
SystemAccount=true
See also Add Guest user to Persistent flash drive
Customize Guest Session