I think the above idea is similar to DeepFreeze or KioskTool concept. but DeepFreeze or KioskTool will lock the whole system or Desktop environment, your can not specify the folder.
Here are the basic steps to do the work as what I described above:
1. Download file install.sh to somewhere in your computer
2. Go to Konsole and log in as root
3. Go to the location of install.sh then run command ./install
4. Input folder name that you want to lock then you are done
Here is detail of install.sh file:
Naturally, if you want the backup tarball or scripts stored somewhere else or named something else, just modify the scripts to indicate the correct directories and filenames.
#!/bin/bash#input folder name, suppose that folder is located in desktopfinputbox(){dialog --title "Inputbox - To take input from you" --backtitle "Linux Shell\Script Tutorial" --inputbox "Enter folder name on Desktop please" 8 60 2>/tmp/input.$$sel=$?na=`cat /tmp/input.$$`case $sel in0) echo "Folder name is $na" ;;1) echo "Cancel is Press" ;;255) echo "[ESCAPE] key pressed" ;;esaccheckdir="/home/$USER/Desktop/$na"if [ -d "$checkdir" ]thennum=1elsenum=2fi}#check folder is exist?num=2echo $numwhile [ $num -eq 2 ]dofinputboxdone
#create backup file
touch /home/backup.shchmod 777 /home/backup.shcd /homeecho "#!/bin/bash" > backup.shecho "rm -f /root/bakcup_file.tar" >> backup.shecho "tar -cpPf /root/bakcup_file.tar /home/$USER/Desktop/$na" >> backup.shecho "chmod 777 /root/bakcup_file.tar" >> backup.shecho "exit 0" >> backup.sh#run backup file to back up the folder that you input./backup.sh
#create restoration filetouch /etc/init.d/restore.shchmod 777 /etc/init.d/restore.shcd /etc/init.d/echo "#!/bin/bash" > restore.shecho "rm -fR /home/$USER/Desktop/$na" >> restore.shecho "tar -xpPf /root/bakcup_file.tar" >> restore.shecho "exit 0" >> restore.sh
#Write to boot script: inittab, rcgrep "/etc/init.d/restore.sh" /etc/inittab >/tmp/inittab.$$grep "/etc/init.d/restore.sh" /etc/init.d/rc >/tmp/rc.$$ninittab=`cat /tmp/inittab.$$`nrc=`cat /tmp/rc.$$`if [ "$ninittab" != "/etc/init.d/restore.sh" ]thenecho "/etc/init.d/restore.sh" >> /etc/inittabfiif [ "$nrc" != "/etc/init.d/restore.sh" ]thencd /etc/init.d/sed -e 's/exit 0//' rc > file.outecho "/etc/init.d/restore.sh" >> file.outecho "exit 0" >> file.outcat file.out > rcfi# remove template filerm -f /tmp/input.$$rm -f /tmp/ninittab.$$rm -f /tmp/nrc.$$
exit 0
Any feedback is warmly welcome