Ubuntu Forums ubuntu.com - launchpad.net - ubuntu help  

Go Back   Ubuntu Forums > The Ubuntu Forum Community > Forum Archive > Main Support Categories > Desktop Environments
Register Reset Password Forum Help Forum Council Search Today's Posts Mark Forums Read

Hello, Unregistered You are browsing a READ only archive of the main support categories pre 4/21/2008. You will not be able to post or reply any threads in this section.

Desktop Environments
Support for your Ubuntu desktop. Including Gnome, KDE and XFCE.

 
Thread Tools Display Modes
Old October 16th, 2005   #1
EnderTheThird
A Carafe of Ubuntu
 
Join Date: May 2005
Location: Bloomington, IN
Beans: 112
Gutsy Gibbon Testing
Send a message via AIM to EnderTheThird
Ubuntu for a Public Computer

I work at a rather small hotel, and we had an extra computer lying around that we put in the lobby so guests without laptops could use it to access the Internet with our high speed connection. Windows XP is on there right now, so naturally it has been filled with a bunch of unnecessary crap since we got it set up (had difficulties getting the wireless to work while using a Guest account, so 90% of the time it's logged in as administrator).

Now I've been using Ubuntu more often at home, and with Breezy out now I would like to put that on there. That way they can't install anything that they shouldn't be, and they can still use Firefox and OpenOffice to do everything they need to. What I'm wondering is if any of you know of something I can use to occasionally wipe all temporary user files from the Home directory and reload it with a pre-configured set of files. I would still like them to be able to download, save, edit, and send any files that they need to using the Desktop and/or Home folders, but I don't want to have to manually delete all of the files every day/week.

Would there be a simple script that I could make or you guys could give me that would wipe the Home directory before the user logs off/on every time and re-creates it with that preconfigured setup?

Hopefully you guys understood all of that and have an idea of what I'm asking. If it doesn't make sense or if something's not clear, just let me know. Thanks!
EnderTheThird is offline   Reply With Quote
Old October 16th, 2005   #2
cwaldbieser
May the Ubuntu Be With You!
 
cwaldbieser's Avatar
 
Join Date: Oct 2004
Location: Pennsylvania
Beans: 1,697
Re: Ubuntu for a Public Computer

Quote:
Originally Posted by EnderTheThird
I work at a rather small hotel, and we had an extra computer lying around that we put in the lobby so guests without laptops could use it to access the Internet with our high speed connection. Windows XP is on there right now, so naturally it has been filled with a bunch of unnecessary crap since we got it set up (had difficulties getting the wireless to work while using a Guest account, so 90% of the time it's logged in as administrator).

Now I've been using Ubuntu more often at home, and with Breezy out now I would like to put that on there. That way they can't install anything that they shouldn't be, and they can still use Firefox and OpenOffice to do everything they need to. What I'm wondering is if any of you know of something I can use to occasionally wipe all temporary user files from the Home directory and reload it with a pre-configured set of files. I would still like them to be able to download, save, edit, and send any files that they need to using the Desktop and/or Home folders, but I don't want to have to manually delete all of the files every day/week.

Would there be a simple script that I could make or you guys could give me that would wipe the Home directory before the user logs off/on every time and re-creates it with that preconfigured setup?

Hopefully you guys understood all of that and have an idea of what I'm asking. If it doesn't make sense or if something's not clear, just let me know. Thanks!
I would think that these steps should work:
1) Create new user. Set up home directory how you want it. Configure the settings, etc.
2) archive the home directory with "tar" and put it somewhere safe that the guest user doesn't have write access. Read access will be required.
3) I think "gnome-session" is the program that starts up a new Gnome session when a user logs on. I think there is some sort of startup script that it runs before the session actually starts. If not, you could do something like renaming "gnome-session" to "gnome-session-2" and creating a script called "gnome-session" that deletes the current $HOME directory and unpacks the tar archive in its place if (and only if!) $HOME == /home/guest. This is the trickiest bit, and you should be comfortable working in the command line or have an alternate window manager set up, as if you mess it up, you probably won't be able to get back into Gnome to correct any mistakes. The last line of the script would be:
Code:
exec gnome-session-2
to execute the original gnome-session program.

Not sure exactly details you need filled in, as I have no idea what your experience with basic shell scripting is. If you need more help, feel free to ask more specific questions. Maybe someone else will have even written up a better script by the time I finish this reply!
cwaldbieser is offline   Reply With Quote
Old October 17th, 2005   #3
EnderTheThird
A Carafe of Ubuntu
 
Join Date: May 2005
Location: Bloomington, IN
Beans: 112
Gutsy Gibbon Testing
Send a message via AIM to EnderTheThird
Re: Ubuntu for a Public Computer

I don't really have any experience with shell scripting. I understand how they work, but that's about it. I don't know the language nor the filesystem well enough to know what commands to use and where to put the script file so that it is executed correctly. Thanks for the input, and if anyone else has something to add, please do so.
EnderTheThird is offline   Reply With Quote
Old October 17th, 2005   #4
mgor
A Carafe of Ubuntu
 
mgor's Avatar
 
Join Date: Apr 2005
Location: Sundsvall, Sweden
Beans: 143
Ubuntu 7.10 Gutsy Gibbon
Re: Ubuntu for a Public Computer

Advanced bash scripting guide is _really_ good for learning bash:
http://www.tldp.org/LDP/abs/html/

oh, if you're running kubuntu this might be helpful:
http://www.linuxcompatible.org/KIOSK...ed_s30591.html
kde has nice kiosk features.

i also found this about locking down gnome:
http://www.redhat.com/docs/manuals/e...-overview.html
__________________
Quote:
Originally Posted by Benjamin Franklin
They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.

Last edited by mgor; October 17th, 2005 at 10:12 AM..
mgor is offline   Reply With Quote
Old October 17th, 2005   #5
stack445
5 Cups of Ubuntu
 
Join Date: Apr 2005
Location: montreal
Beans: 29
Send a message via MSN to stack445
Re: Ubuntu for a Public Computer

Ive been thinking about a .login and a .logout file. These file execute command either at login time or at logout time. You could actauly delete the content of the home folder ( execpt some file like the .login and .logout ) and copy a default home folder pre-set like you want. Ive been trying to do it on my machine ( with the help of the new login in system tools. Quite handy ) but did not manage to do it yet. Of course im not a jedi by anymean.

If someone with a bit more experience could tell me if i'm looking in the right direction or not ? I do know that the .login and .logout are a bit more UNIX related than to linux
stack445 is offline   Reply With Quote
Old October 17th, 2005   #6
dabear
Quad Shot of Ubuntu
 
Join Date: May 2005
My beans are hidden!
Send a message via MSN to dabear
Re: Ubuntu for a Public Computer

Here's how you could do it:

Make a guest user called «guest».
Make a script calling the «users» command, finding out if the user guest is logged in or not. If he/she is not logged in, wipe out the /home/guest directory. Offcourse, you would have to run this script in some kind of loop; may I suggest cron jobs?
dabear is offline   Reply With Quote
Old October 18th, 2005   #7
cwaldbieser
May the Ubuntu Be With You!
 
cwaldbieser's Avatar
 
Join Date: Oct 2004
Location: Pennsylvania
Beans: 1,697
Re: Ubuntu for a Public Computer

Quote:
Originally Posted by EnderTheThird
I don't really have any experience with shell scripting. I understand how they work, but that's about it. I don't know the language nor the filesystem well enough to know what commands to use and where to put the script file so that it is executed correctly. Thanks for the input, and if anyone else has something to add, please do so.
Well you should be able to create the new user on your own. I will assume it is named "guest" in these examples. Once it is set up the way you want it, log in as your admin account and:
Code:
$ cd
$ mkdir guest_bkup
$ chmod u=rwx guest_bkup
$ chmod go=r guest_bkup
$ cd guest_bkup
$ tar --bzip2 -cvvf guest.tar.bz2 /home/guest
This will backup the entire home directory of the guest user to a tar archive that is compressed with bzip2. The backup will be in your admin user's ~/guest_bkup folder. The guest user can read this folder, but nothing else.

Now you need to create a script to restore the home directory. Open your favorite editor and create a file called "restore_guest.sh" in ~/guest_bkup. In it, paste the following (I assume your admin user is named "admin"-- this is not likely to be the case so you should change it):
Code:
#!/bin/bash

#Enter guest's home directory and erase all files.
cd /home/guest
rm -R *
#Enter home directory.
cd /home
#Restore archive into guest folder.
tar -xvvf /home/admin guest.tar.bz2
Make the script executable with
Code:
chmod ugo+x restore_guest.sh
You should be able to test the script at this point:
Code:
$ sudo su guest
$ cd
$ rm -R /home/guest/*
$ /home/admin/guest_bkup/restore_guest.sh
This changes your user to guest. Then you change to guest's home folder and erase all the files in his home directory. Then you try to run the script to restore it.

I haven't tested this script out myself, so it may be a bit buggy. If you can get that much to work, I'll expalin how you can rig it so the restore script runs before each login.
cwaldbieser is offline   Reply With Quote

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:24 AM.


vBulletin ©2000 - 2010, Jelsoft Enterprises Ltd. Ubuntu Logo, Ubuntu and Canonical © Canonical Ltd. Tango Icons © Tango Desktop Project. lingonberry