The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 02-10-2009
ddreggors ddreggors is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 91
As long as guests are unprivileged users that cannot change things outside of their home directory (/home/guest ?) this is relatively simple.


You can make a copy/backup of the freshly created guest user's home directory:
Code:
cp -rp /home/guest /home/guest_bak
and on startup remove the guest home directory and copy the backup back into place.

If you made a backup as "/home/guest_bak" (directory not file). Then you can make a script like:

Code:
#!/bin/sh

rm -f /home/guest
cp -rp /home/guest_bak /home/guest
Give that script a name like clean_guest.sh, move it to somewhere like /usr/local/bin, make it executable:
Code:
chmod +x /usr/local/bin/clean_guest.sh
Call it from inside /etc/rc.local (redhat) or similar init script and now any changes made or files copied will be gone and have a freshly built user home again.

Last edited by ddreggors; 02-10-2009 at 01:53 AM..